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

more functions accepting IWebElement #93

Closed
AlexeyRaga opened this issue Aug 29, 2013 · 11 comments
Closed

more functions accepting IWebElement #93

AlexeyRaga opened this issue Aug 29, 2013 · 11 comments

Comments

@AlexeyRaga
Copy link

It would be nice to make more functions to accept IWebElement, not only css selector.

For example, read function would be useful in case when you find an element through element |> elementsWithin |> List.find pipeline and want to read its value, or assert its value.

I see there is a function textOf but it is currently private...

Similar for assertions.

@lefthandedgoat
Copy link
Owner

Ok I can do this tonight probably.

@lefthandedgoat
Copy link
Owner

I made this change for read, clear, selected, and deselected.

It will go into a new build shortly.

Which assertions do you think should have this behavior?

@lefthandedgoat
Copy link
Owner

Now available in canopy 0.8.0
http://www.nuget.org/packages/canopy

@AlexeyRaga
Copy link
Author

Thanks a lot!!!
For assertions (and for other behaviors), I think it should be transparent and should work in both cases whether I have IWebElement or just a selector.

@lefthandedgoat
Copy link
Owner

Something like
"#someSelector" == "SomeText"

also would work as
let elem = element "#someSelector"
elem == "SomeText"

?

If so, I can do that, it will take a bit of time because some of the assertions are complicated. Its definitely doable though.

@AlexeyRaga
Copy link
Author

Yes, I meant something like that.
I think it is more like enhancement or a low-priority item anyway because now we can do

//get an element somehow
let elem = element "#someSelector" 
read elem == "Some Test"

@ssboisen
Copy link

I agree that most functions should work with both IWebElement and a cssselector directly. In my use of canopy I've missed having displayed and notDisplayed as well as check and uncheck that works on IWebElement since I've used elements in order to extract a number of elements. The following shows a practical usecase of both checked and displayed for IWebElement where a graph and checkboxes to toggle graph visibility is used together. In my own code I had to create my own version of check and displayed that worked on IWebElement.

let seriesCheckBoxes = elements "div.site-show-on-non-mobile checklist input[type=checkbox]" |> Array.ofList
let seriesGraphs = elements "g.highcharts-series-group g.highcharts-series" |> Seq.take seriesCheckBoxes.Length |> Array.ofSeq
let zipped = Array.zip seriesCheckBoxes seriesGraphs

zipped |> Array.iter (fun (cb, g) -> 
                    check cb
                    displayed g
                    )

@lefthandedgoat
Copy link
Owner

I can add this. Thanks for the feedback!

@lefthandedgoat
Copy link
Owner

@ssboisen this change is now available in nuget 0.8.6. If you need anymore changed please let me know!

@ssboisen
Copy link

Awesome, thank you!

@lefthandedgoat
Copy link
Owner

Closing this. If you would like to see any other features added to canopy open a ticket and I will do my best!

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