I want to allow location and notifications on Chrome in incognito mode using Selenium
.
Here is my code:
import selenium
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
option = Options()
option.add_argument("--incognito")
option.add_argument("--disable-infobars")
option.add_argument("start-maximized")
option.add_argument("--disable-extensions")
option.add_experimental_option("prefs", {
"profile.default_content_setting_values.notifications":1,
"profile.default_content_setting_values.geolocation": 1,
})
driver = webdriver.Chrome(options=option, executable_path="D:X PROJECTS\\chromedino\\Webdriver\\chromedriver.exe")
This code works (Notifications and Location are enabled) if option.add_argument("--incognito")
isn't included (the browser is opened in normal mode). Why is this happening and how can I enable these along with incognito mode?
Note: You can check if location is enabled by open a website that requests your location.
from How to allow Location and Notifications in Chrome incognito mode in Python Selenium?
No comments:
Post a Comment