一、通过执行js脚本触发点击事件
页面元素结构如下图所示:
通过如下方式获取该元素后直接点击会报错:
selenium.common.exceptions.WebDriverException: Message: element click intercepted: Element ... is not clickable at point (467, 22). Other element would receive the click: ...
more_btn = WebDriverWait(self.driver,20,0.5).until(
EC.visibility_of_element_located((By.ID,'btn_layer_title_options'))
more_btn.click()
解决方法:通过执行js脚本点击该元素
more_btn = WebDriverWait(self.driver,20,0.5).until(
EC.visibility_of_element_located((By.ID,'btn_layer_title_options')
driver.execute_script("arguments[0].click();", more_btn)
二、通过pyautogui库操作
pyautogui是一个图形用户界面自动化工具,通过屏幕x,y坐标系统来确定目标位置,控制鼠标和键盘发送虚拟击键和