python+selenium button定位方法

报错内容:

selenium.common.exceptions.ElementClickInterceptedException

元素:

解决方法2种:

1、

tijiao=driver.find_element_by_xpath("html/body/div[12]/div[2]/div[1]/div[1]/div[3]/div[1]/button[2]/span")
driver.execute_script("arguments[0].click();",tijiao)

2、本元素采用第2种方法

btn[0]   : 元素

from selenium import webdriver

webdriver.ActionChains(self.browser).move_to_element(btns[0]).click(btns[0]).perform()

猜你喜欢

转载自www.cnblogs.com/ljf520hj/p/12157396.html