Selenium webdriver_manager根据浏览器版本自动下载对应驱动程序

参考: https://blog.csdn.net/qq_45664055/article/details/132371769

 

        # Enable selenium download function
        chrome_options = webdriver.ChromeOptions()#Use chrome browser
        if platform.system() == "Linux":
            chrome_options.add_argument("--headless")#Set headless when in linux
        try:
#Install chromeDriver if not found service
= Service(executable_path=ChromeDriverManager().install())#只有第一次执行能成功 except: service = Service() self.driver = webdriver.Chrome(service=service, options=chrome_options)

 

posted @ 2023-09-11 22:24  苹果芒  阅读(112)  评论(0编辑  收藏  举报