Issue
How does one make the google chrome tab to not close immediately after its opened. Could use time.sleep or use a while loop in some type of way?
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications": 2}
chrome_options.add_experimental_option("prefs", prefs)
chrome_options.add_experimental_option("useAutomationExtension", False)
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
driver.get("https://www.google.com")
Solution
Found it myself. Use this
chrome_options.add_experimental_option("detach", True)
Answered By - Giannis Tsakas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.