문제

I am really enjoying using Canopy Web Testing to test out my .NET Web Apps with F#. However the documentation is sparse. I'm looking for a hint on how to change an HTML select tag to select an element based on a value of an option.

Right now, all I can manage to do is calling the click event from Canopy, and then firing press down the correct number of times in my test to get to the proper element. Of course, this means my tests all break if the number of elements in the dropdown changes.

Does anyone have an idea of how to use the option tag's value to select it in the UI?

도움이 되었습니까?

해결책

open canopy
open runner

start firefox

"taking canopy for a spin" &&& fun _ ->
    url "http://lefthandedgoat.github.io/canopy/testpages/"

    "#item_list" << read "option[value='2']"

    "#item_list" == "Item 2"

run()

You could write your own helper method to improve this by doing

let option value = read <| sprintf "option[value='%s']" value

"taking canopy for a spin" &&& fun _ ->
    url "http://lefthandedgoat.github.io/canopy/testpages/"

    "#item_list" << option "2"
    "#item_list" == "Item 2"

I will open an issue and add a feature so that you can do the below instead

    "#item_list" << "2"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top