【发布时间】:2020-06-08 07:53:51
【问题描述】:
详情: 在我当前的项目中,我正在 Magento 中编写有关 Python 和 Selenium 的测试用例。在这样做时,我要求一个滑动表面(按钮)。
请求:
def test_pagebuilder_slide_button_pagebuilder_button_primary(self):
driver = self.driver
driver.get("my_webseite.de")
time.sleep(15)
try: driver.find_element_by_id("slick-slide-control01").click()
except AssertionError as e: self.verificationErrors.append(str(e))
time.sleep(15)
现在我收到测试有效的消息,因为另一个区域会阻止这种情况。而且这个虽然我是直接查了ID之后这个是可用的。作为急救的我也休息了一下,也许就是这个原因吧?
错误信息:
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <button type="button" role="tab" id="slick-slide-control01" aria-controls="slick-slide01" aria-label="... of 2" tabindex="-1">2</button> is not clickable at point (517, 612). Other element would
receive the click: <div role="alertdialog" tabindex="-1" class="message global cookie" id="notice-cookie-block" style="">...</div>
您知道如何避免这种情况吗?
【问题讨论】:
-
看起来像是一个警告,告诉用户他们关闭了 cookie。您可能应该先关闭它。 (有关闭按钮吗?)
标签: python python-3.x selenium selenium-webdriver python-unittest