如何更改下拉在F#林冠UI测试脚本 [英] How to change a dropdown in an F# Canopy UI Testing Script

查看:219
本文介绍了如何更改下拉在F#林冠UI测试脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的真的很享受的 雨棚Web测试 以测试出我的.NET Web应用程序使用F#。然而,文件是稀疏。我在找一个提示如何更改HTML 选择标签来选择一个基于值的元素的一个选项。

现在,我只能设法做的是调用从林冠点击事件,然后烧制 preSS下跌正确数量的在我的测试时间去合适的元素。当然,这意味着我的测试中都打破,如果在下拉列表中的变化元素的数量。

有没有人对如何使用选项的想法标签的价值在用户界面中选择它?


解决方案

 开篷
公开赛亚军启动Firefox以树冠兜风&放大器;&功放;&安培;有趣_ - >
    网址http://lefthandedgoat.github.io/canopy/testpages/    #item_list<<读选项[值='2']    #item_list==项目2跑()

您可以编写自己的辅助方法,这样做改善这种

 让期权价值=读< | sprintf的选项[值='%s'的]价值以树冠兜风&放大器;&功放;&安培;有趣_  - >
    网址http://lefthandedgoat.github.io/canopy/testpages/    #item_list<<选择2
    #item_list==项目2

我会打开一个问题并添加功能,使你可以做下面的,而不是

 #item_list<< 2

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"

这篇关于如何更改下拉在F#林冠UI测试脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆