需要将导入的包还有打开浏览器以及账号密码等地方进行修改
#导包
from selenium import webdriver
import time
from selenium.webdriver import ActionChains, DesiredCapabilities
class Common(object):
#初始化 开始的时候执行
def __init__(self):
print("第一个方法执行…………")
#创建浏览器
option = webdriver.ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation']) # webdriver防检测
option.add_argument("--no-sandbox")
option.add_argument("--disable-dev-usage")
option.add_argument("--disable-blink-features=AutomationControlled")
desired_capabilities = DesiredCapabilities.CHROME # 修改页面加载策略
desired_capabilities["pageLoadStrategy"] = "none" # 注释这两行会导致最后输出结果的延迟,即等待页面加载完成再输出
#打开浏览器
self.driver = webdriver.Chrome('E:\python\chromedriver.exe',options=option)
#浏览器最大化
self.driver.maximize_window()
#访问指定url
def open_url(self,url)</

该博客介绍了如何使用Python进行企查查的自动化登录,提醒读者需要在代码中添加自己的账号和密码,并根据浏览器加载速度调整合适的休眠时间,以防页面元素定位失败。
最低0.47元/天 解锁文章
9302





