Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F# Canopy Select or Dropdown with Option Group #240

Closed
chongo2002 opened this issue Mar 7, 2016 · 3 comments
Closed

F# Canopy Select or Dropdown with Option Group #240

chongo2002 opened this issue Mar 7, 2016 · 3 comments

Comments

@chongo2002
Copy link

How do you select an option or set the value in a select list that has option groups?

This method does not work: How to change a dropdown in an F# Canopy UI Testing Script

sample code:

<!DOCTYPE html>
<html>
<body>

<select id="test-select">
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

</body>
</html>

Canopy Test:

open canopy
open runner
open Helpers

    let all() =
    context "OptGroup Tests"

    let page = ""

    ntest ("Testing page " + page) (fun _ ->
        let mUrl = testpage.html
        url mUrl

        "#test-select" << "Audi"
    )

Note I am trying to select by text value, not option value, although I have tried both and neither work.

Issue is on StackOverflow: http://stackoverflow.com/questions/35798661/f-canopy-select-or-dropdown-with-option-group

@amirrajan
Copy link
Collaborator

What I've find myself doing these days is explicitly adding marker attributes to all elements I'd want to interact with. This of course is only viable if you can change the source code.

For this example I'd add a marker class to each option, for example: data-uia-car="Audi" (the attribute value being the text value). Then I can interact with it via canopy by typing click "[data-uia-car='Audi']".

Without changing the markup, you could probably do click "[value='audi']" and it should work.

That being said. I think it'd be cool if canopy could just traverse these kind of optgroup structures and "just work". /cc @lefthandedgoat

@lefthandedgoat
Copy link
Owner

Yep looks like an oversite on my part. I will work to get this fixed soon. Wednesday probably.

Thanks!

@lefthandedgoat
Copy link
Owner

You can download this now! No changes needed on your side. Should 'just work'.

https://www.nuget.org/packages/canopy/0.9.46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants