-
Notifications
You must be signed in to change notification settings - Fork 115
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
Issue With Select List Manipulation #176
Comments
You can do this with xpath go to this page http://lefthandedgoat.github.io/canopy/testpages/ using chrome dev tools run this command from console (chrome dev tools will run xpath selectors using $x() ) $x("id('states')/option[@value != ''][1]") This will find the element with id of state, find all options with value != '' and return the 1st one. Your helper would look something like this (not tested)
This will fail if there is no option inside the selector your provided, so you can also use someElementWith and match for Some/None like in your example Technically when you use << on a select it just finds the option with the text you provide (from read) and clicks it, you can see that here: https://github.com/lefthandedgoat/canopy/blob/master/src/canopy/canopy.fs#L297 So you may just want to do this (also not tested):
|
That gives me something to work with. Thanks a lot! |
For nth element you can do:
or
For by text (or value) this works
|
Posted on stackoverflow: http://stackoverflow.com/questions/27250994/canopy-working-with-select-lists
I have just started working with Canopy and am struggling with select lists. I know you can set the selected item by value by doing:
However, how would you select the nth element of a select list? Or, how about selecting by text? I can't seem to find anything in the documentation.
I tried writing some helpers to select the first non-blank option in a select list. The weird thing is that it works the first time I call it, but every subsequent call to the helper method times out. I'm baffled and also an F# newbie ;)
The text was updated successfully, but these errors were encountered: