python+selenium自動化,沒有寫close和quit,瀏覽器窗口會自動關閉解決方案
#增加參數
option.add_experimental_option("detach", True)
例如:
#加啟動配置 option = webdriver.ChromeOptions() #關閉“chrome正受到自動測試軟件的控制” #V75以及以下版本 #option.add_argument('disable-infobars') #V76以及以上版本 option.add_experimental_option('useAutomationExtension', False) option.add_experimental_option('excludeSwitches', ['enable-automation']) #不自動關閉瀏覽器 option.add_experimental_option("detach", True) # 打開chrome瀏覽器 driver = webdriver.Chrome(chrome_options=option) return driver
chrome正受到自動測試軟件的控制