的webdriver - 元素无法点击浏览器 [英] WebDriver - element is not clickable Chrome
本文介绍了的webdriver - 元素无法点击浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下问题。我运行Firefox和Chrome测试。在Firefox的测试运行正常,但在Chrome SauceLabs发出的信息:
I have following problem. I run test on Firefox and Chrome. On Firefox test run correctly but on Chrome SauceLabs give a message:
unknown error: Element is not clickable at point (717, 657). Other
element would receive the click: <div class="col-md-9 col-sm-12"
style="margin-top:8px;">...</div> (Session info: chrome=36.0.1985.125)
(Driver info: chromedriver=2.10.267521,platform=Windows NT 6.3 x86_64)
我选择通过独特的CSS选择元素以同样的方式两个测试:
I choose element by unique css selector in both test in the same way:
driver.FindElement(By.CssSelector("button.btn-xs:nth-child(1)")).Click();
任何想法有什么错在这里?
Any ideas what is wrong here?
推荐答案
我假设你有你需要正确的元素,即XPath是正确的。
这里有一些出路:
I am assuming that you have the correct element you need, ie the XPath is correct. Here are few ways out:
- 尝试点击
父元素
代替。 - 尝试。
提交()
而不是。点击()
- 尝试执行
的JavaScript
将在的OnClick执行
您尝试单击该元素的事件。
- Try to Click on the
parent element
instead. - Try .
Submit()
instead of.Click()
- Try to execute the
JavaScript
that will be executed on theOnClick
event of the element you are trying to click.
我已经成功地使用所有的时间第三路。
I have used the 3rd way with success all the time.
另外一个
- 请在
.SendKeys(Keys.Enter)
的元素(或空格键)
- Do a
.SendKeys(Keys.Enter)
on that element (or a Space key)
这篇关于的webdriver - 元素无法点击浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文