python selenium 处理悬浮窗口

from selenium.webdriver.common.action_chains import ActionChains
ActionChains(driver).move_to_element(e).perform()


#encode=utf-8
from selenium import webdriver
import time
from selenium.webdriver.common.action_chains import ActionChains
driver=webdriver.Firefox()
driver.get("https://www.baidu.com")
driver.implicitly_wait(30)
e=driver.find_element_by_link_text("更多产品")
ActionChains(driver).move_to_element(e).perform()
time.sleep(0.5)
js="document.getElementsByName('tj_more')[0].click()"
driver.execute_script(js)
time.sleep(0.5)
driver.get_screenshot_as_file("D:\\python\\test\\test.png")
driver.quit()
 

 

相关文章:

  • 2021-09-28
  • 2022-12-23
  • 2021-04-12
  • 2021-11-01
  • 2021-08-15
  • 2022-12-23
  • 2021-07-30
  • 2022-01-04
猜你喜欢
  • 2021-09-29
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案