admin管理员组

文章数量:1536778

使用selenium打开360浏览器需要一点技巧,因为360浏览器其实是Chrome的内核,所以需要先查清楚对于的内核版本,打开帮助-关于360浏览器,如下


查到内核版本为78.0…,于是到这个网站下载对应的驱动
https://chromedriver.storage.googleapis/index.html?path=
下载到chromedriver.exe,放到代码所在目录,然后代码如下:

from selenium import webdriver
from selenium.webdriver.common.by import By

options = webdriver.ChromeOptions()
options.binary_location ="C:\\Users\\yourname\\AppData\\Roaming\\360se6\\Application\\360se.exe" 
driver = webdriver.Chrome('chromedriver.exe',options=options)       #必须和360内核匹配
driver.get('https://sipub.sz.gov/hspms/')			#深圳社保网站
driver.implicitly_wait(3)
try:
  driver.find_element_by_link_text('关闭').click()                     #关闭弹框
except:
  pass
driver.find_element_by_id("userNameInput").send_keys('username')
driver.find_element_by_id("userPwdInput").send_keys('password')     
driver.find_element_by_class_name("btn-logon").click()

本文标签: 社保自动登录浏览器网站Python