PYTHON自动化测试
python吧
全部回复
仅看楼主
level 1
angere之泪 楼主
代码如下:
driver.find_element_by_xpath(".//*[@class='layui-layer-ico layui-layer-close layui-layer-close1']").click()
提示错误:
ElementClickInterceptedException('element click intercepted: Element <a class="layui-layer-ico layui-layer-close layui-layer-close1" href="javascript:;"></a> is not clickable
想自动化测试 关闭窗口发现不能点击,也发现元素多个相同,求大神指教教,
2020年03月12日 11点03分 1
level 11
试试element_to_be_clickable或visibility_of_element_located。
等待元素可点击,等待元素可见。
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as expected
wait = WebDriverWait(driver, timeout=30)
wait.until(expected.visibility_of_element_located((By.XPATH, '//xpath'))).click()
wait.until(expected.element_to_be_clickable((By.XPATH, '//xpath'))).click()
2020年03月12日 15点03分 3
意思是元素没有出现?来不及响应?
2020年03月13日 23点03分
@angere之泪 没有wait是有可能的,因为浏览器加载需要点时间。
2020年03月14日 00点03分
@Critic2012 这个也解决不到,应该不是等待问题
2020年03月16日 01点03分
level 1
angere之泪 楼主
点击关闭窗口元素无效,大神在哪里
2020年04月01日 03点04分 5
level 8
查看取出来元素是取消么,多个相同class取元素一定要检查取出来的是谁。
2020年07月31日 19点07分 7
1