我正在使用selenium和C#编写我的测试。
我无法单击下拉列表来选择所需的值,这在Windows 8 IE 10上发生。单击已执行,但下拉列表未显示(展开),不会抛出任何异常。
相同的脚本在Windows 7和Windows 8上的Chrome 35,Firefox 29,IE 9等其他浏览器上运行良好。脚本也适用于Windows 7上的IE 10,它导致了问题的Windows 8。 / p>
我试图通过更改IE驱动程序和selenium dll的版本来使其工作,但这不起作用。我还尝试使用javascript执行程序执行单击,但这也没有。
以下是相同的片段。
IWebElement dropdown = driver.FindElement(By.ClassName("dropdown"));
IWebElement drop = dropdown.FindElement(By.ClassName("drop"));
drop.Click();
for java script click
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].click();", drop);
下拉列表的HTML:
<table id="Select_0" class="dropdown" cellspacing="0" cellpadding="0" aria-haspopup="true" role="listbox" data-dojo-attach-point="_buttonNode,tableNode,focusNode,_popupStateNode" style="-user-select: none;" tabindex="0" widgetid="Select" aria-expanded="false" aria-invalid="false" popupactive="true" aria-owns="Select_0_menu">
<tbody role="pres">
<tr role="pres">
<td class="classrandom" role="presentation">
<div class="drop" role="presentation" data-dojo-attach-point="containerNode,textDirNode"></div>
对此有任何解决方法吗?
提前致谢!