Selenium绕过登录的实现

1、使用命令行启动Chrome:
Mac:/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome -remote-debugging-port=9999
Windows:chrome.exe --remote-debugging-port=9222

2、初始化Chrome:

def setup_method(self):
    chrome_options = webdriver.ChromeOptions()
    chrome_options.debugger_address ="127.0.0.1:9999"

    self.driver = webdriver.Chrome(options=chrome_options)
    self.driver.implicitly_wait(10)

3、编写对应的脚本:

上一篇:python-处理仅在启动后立即出现的错误


下一篇:我的DEBUG = False时,Django为什么不通过电子邮件向我发送错误?