我真的很高兴使用
Canopy Web Testing用F#测试我的.NET Web Apps.但是文档很少.我正在寻找一个关于如何更改HTML选择标记以根据选项的值选择元素的提示.
现在,我所能做的就是从Canopy调用click事件,然后在我的测试中按下正确的次数以获得正确的元素.当然,这意味着如果下拉列表中的元素数量发生变化,我的测试都会中断.
有没有人知道如何使用选项标签的值在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()
您可以编写自己的帮助方法来改进这一点
- 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"
- "#item_list" << "2"