Selenium点击区域不工作

时间:2015-07-29 09:50:27

标签: c# .net selenium

我有数字图像,我建立了一些返回所有数字区域和区域ID的方法,但是当我点击时没有任何反应。

这里是区域的html代码:

<map id="tc_tclavier1438161670450" style="display:block" name="tc_tclavier1438161670450">
<area id="touche11" class="touche" coords="0,0,24,24" style="cursor: pointer;display:block;">
<area id="touche12" class="toucheVide" coords="24,0,48,24" style="cursor: pointer;display:block;">
<area id="touche13" class="touche" coords="48,0,72,24" style="cursor: pointer;display:block;">
<area id="touche14" class="toucheVide" coords="72,0,96,24" style="cursor: pointer;display:block;">
<area id="touche21" class="touche" coords="0,24,24,48" style="cursor: pointer;display:block;">
<area id="touche22" class="toucheVide" coords="24,24,48,48" style="cursor: pointer;display:block;">
<area id="touche23" class="touche" coords="48,24,72,48" style="cursor: pointer;display:block;">
<area id="touche24" class="toucheVide" coords="72,24,96,48" style="cursor: pointer;display:block;">
 </map>

在我使用我的方法后,我知道所有号码在哪里,并且有他们的ID,我试图点击区域,但是没有工作。

这是我试过的:

driver.FindElement(By.Id("touche13")).Click();
driver.FindElement(By.Id("touche13")).SendKeys(Keys.Return);

有人知道我做错了吗?

1 个答案:

答案 0 :(得分:0)

使用Xpath Path和Css Selector语句检查