Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Watin单击下拉菜单按钮_C#_Asp.net_Testing_Watin - Fatal编程技术网

C# 使用Watin单击下拉菜单按钮

C# 使用Watin单击下拉菜单按钮,c#,asp.net,testing,watin,C#,Asp.net,Testing,Watin,我正在使用Watin测试一个网站,页面中有一个下拉菜单按钮,如\[Download | V\]“>如果我找到该按钮并单击它,单击整个按钮并选择菜单中的第一个选项,但我想单击按钮的V以显示下拉菜单(div)然后从中选择我试图点击按钮的代码 ff.Button(Find.By("aria-describedby", "x-auto-456")).FireEvent("onmouseover"); ff.Button(Find.By("aria-describedby", "x-auto-456"))

我正在使用
Watin
测试一个网站,页面中有一个下拉菜单按钮,如\[Download | V\]“>如果我找到该按钮并单击它,单击整个按钮并选择菜单中的第一个选项,但我想单击按钮的
V
以显示
下拉菜单(
div
)然后从中选择我试图点击按钮的代码

ff.Button(Find.By("aria-describedby", "x-auto-456")).FireEvent("onmouseover");
ff.Button(Find.By("aria-describedby", "x-auto-456")).FireEvent(" Onmousedown");
ff.Button(Find.By("aria-describedby", "x-auto-456")).Click();
按钮
HTML

<button class="x-btn-text" style="position: relative; width: 16px;" type="button" tabindex="0" aria-describedby="x-auto-456">

您找不到正确的按钮:

Button button = ff.Button(Find.ByClass("x-auto-457"));

您需要根据其类名查找按钮。请注意,将查找具有该类名的第一个
元素。如果您仍然没有找到正确的按钮,请检查页面上有多少按钮具有类属性值的
x-auto-457

选择元素是动态生成的,或者是自动生成的已经存在,如果它已经存在,只需选择select元素。@VinayPratapSingh它是在选中
复选框后动态生成的。
复选框的检查是使用
WATIN
完美完成的。您能给我们展示下拉列表的HTML标记结构吗?知道这将是解决此问题的关键。@GregBurghardt下拉列表(div)HTML只有在按钮点击后才可见。我被卡在按钮点击本身上。我正在找到按钮并正确点击它,但我的问题是它点击按钮,而不是显示div,而是在div中选择一个选项并开始处理。正如我的一位朋友建议的那样,我可以在b中获得图像的坐标吗单击按钮并单击它
Button button = ff.Button(Find.ByClass("x-auto-457"));