这是我用硒测试的html标记(像对象一样的瓦片)的外观。
测试的目标是通过点击附加屏幕截图中显示的汉堡包图标来触发下拉菜单。
以下是相关代码
dropdown_menu = tile.find_element_by_class_name('dropdown-toggle')
dropdown_menu.click()
当谈到click
函数调用时,我收到了这个错误:
WebDriverException: Message: unknown error: Element is not clickable at point (528, 125). Other element would receive the click: <span class="icon-file"></span>
icon-file
类是图块左上角的蓝色图标。
但是,当我在firefox中测试相同的代码时,我没有得到这个异常。
行为差异的可能原因是什么?
答案 0 :(得分:0)
我在两行之间添加了time.sleep(5)
并解决了问题
dropdown_menu = tile.find_element_by_class_name('dropdown-toggle')
time.sleep(5)
dropdown_menu.click()
感谢Peanut在评论中找到错误报告的链接