我有一个webobject
,当我点击它,我得到:检查Web对象是否位于Selenium中的其他Web对象的前面?
selenium.common.exceptions.WebDriverException: Message: u'unknown error: Element is not clickable at point (128, 605). Other element would receive the click: ...\n (Session info: chrome=37.0.2062.120)\n (Driver info: chromedriver=2.10.267518,platform=Linux 3.13.0-36-generic x86_64)'
的原因是,有在它的前面,即约饼干消息的其他对象。那么当我点击它时,如何确保Web对象前面没有任何东西?
例子:
from selenium import webdriver
browser = webdriver.Chrome()
browser.get("http://cookie-script.com/")
browser.set_window_size(800, 800)
# Click the Start button that is behind the 'Cookies' popup
el=browser.find_elements_by_xpath("id('sp-feature')/div[1]/p[2]/a[1]")[0]
el.click()
也许会添加一些JavaScript /逻辑,只为您的硒测试激活,隐藏不必要的弹出窗口等? – michaelb 2014-10-01 14:17:31
@michaelb以及我正在测试一个网站,那么这将是一件坏事。 – Pithikos 2014-10-01 14:18:48
那么,如果有什么东西在可点击的对象前面,那么真正的用户也会有麻烦,所以这也是不正确的。也许在你的测试中,首先关闭cookie信息? – michaelb 2014-10-01 14:20:27