出问题的代码如下,确切的说是e.click出了错误。找了下原因。
e=drive.find_element(By.XPATH,r'''//*[@id="app-content"]/div/div[3]/div/div/button''')
e.click()
原因”web自动化过程当中,特别是树结构,在树的末端,点击不到“,(并不是找不到,而是点击不到)web自动化通过execute_script去实现元素点击事件
e=drive.find_element(By.XPATH, r'''//*[@id="app-content"]/div/div[3]/div/div/button''')
drive.execute_script("arguments[0].click();", e)