C# Firefox点击操作不';我不能正常工作
我对C# Firefox点击操作不';我不能正常工作,c#,html,selenium-webdriver,C#,Html,Selenium Webdriver,我对IWebElement有一个问题。单击()。 该网页约有20个相同结构的项目: <area alt="0" shape="circle" coords="190,88,28" href="build.php?id=1"> <area alt="1" shape="circle" coords="280,89,28" href="build.php?id=2"> <area alt="2" shape="circle" coords="348,101,28" hr
IWebElement有一个问题。单击()。
该网页约有20个相同结构的项目:
<area alt="0" shape="circle" coords="190,88,28" href="build.php?id=1">
<area alt="1" shape="circle" coords="280,89,28" href="build.php?id=2">
<area alt="2" shape="circle" coords="348,101,28" href="build.php?id=3">
<area alt="3" shape="circle" coords="132,127,28" href="build.php?id=4">
<area alt="4" shape="circle" coords="245,140,28" href="build.php?id=5">
<area alt="5" shape="circle" coords="302,147,28" href="build.php?id=6">
<area alt="6" shape="circle" coords="387,145,28" href="build.php?id=7">
<area alt="7" shape="circle" coords="72,178,28" href="build.php?id=8">
但有时driver.Navigate().gotour()会打开新窗口或浏览器选项卡(可能是某些类型的驱动程序配置超时?)
注意:我尝试使用selenium id访问元素,但没有任何问题。这是一个黑暗中的刺刀,但是您确定页面上没有id=5的其他元素吗?这可以解释你所看到的,另一个元素实际上被点击了。实际上,我试图指定包含
的上部
,结果是它是唯一一个有此规范的区域。此外,我还观察了任何带有“build.php?=5”的元素,什么都没有,唯一的链接是那些带有href=“build.php?id=”的区域。另一件事是,如果我在firefox中使用selenium ide命令:单击| css=area[href=“build.php?id=5”],它会工作并打开链接。我被困在这里,找不到任何已知bug或其他东西的文档。你还有其他想法吗?除了Webdriver,还有其他的东西吗?除了Webdriver,还有其他的webautomation技术吗?还有与.Net WPF的WebBrowser一起使用的技术吗?
String URL = "map area[href=\"build.php?id=" + id + "\"]";
element = wait.Until<IWebElement>((d) => { returnd.FindElement(By.CssSelector(URL)); });
if (element != null)
{
element.Click();
element = wait.Until<IWebElement>((d) => { return d.FindElement(By.CssSelector(button)); });
}
driver.Navigate().GoToURL("*/build.php?id=5");