lefthandedgoat / canopy

f# web automation and testing library, built on top of Selenium (friendly to c# also)
http://lefthandedgoat.github.io/canopy/
MIT License
506 stars 115 forks source link

Timing issues can lead to weird suggestions #463

Open forki opened 5 years ago

forki commented 5 years ago

image

I think if we find a suggestion that matches - we should just take it ;-)

forki commented 5 years ago

ok scratch that. It's not because of timing.

let removeBtn = titleElement |> parent |> parent |> elementWithin "Remove"

so it finds the "Remove" but not within that other element

amirrajan commented 5 years ago

Are you allowed to put an explicit data attribute on the element? For example:

<button data-canopy-id="remove-button" />

That way you can find it directly without having to do any complex traversals.

forki commented 5 years ago

The button is in a table. Every row has a remove element.

Am Sa., 1. Dez. 2018, 18:17 hat Amir Rajan notifications@github.com geschrieben:

Are you allowed to put an explicit data attribute on the element? For example:

forki commented 5 years ago

Btw my test is working fine now. It was revealing a real bug. My point here is that elementWithin should not use suggestions for the whole page. It should only suggest actual sub elements.

lefthandedgoat commented 5 years ago

I think that may be a one liner, I can try it out later.

https://github.com/lefthandedgoat/canopy/blob/master/src/canopy/canopy.parallell.functions.fs#L265

Change browser -> searchContext