How I create LOCAL Chrome Webdriver WITH Current user data
chromedriver = "/Users....../chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
options = webdriver.ChromeOptions()
options.add_argument(r"user-data-dir=/Users..../Google/Chrome")
webdriver.Chrome(executable_path=chromedriver,
chrome_options=options)
How I create REMOTE Chrome webdriver with clear - new user data
webdriver.Remote(command_executor="http://192.168.1.30:4441/wd/hub",
desired_capabilities=DesiredCapabilities.CHROME)
Now, How create Remote Chrome webdriver with current user data?
We can use a specific Chrome profile in Selenium. This can be done with the help of the ChromeOptions class. We need to create an object of this class and then apply addArguments method on it. The path of the specific Chrome profile that we want to use is passed as a parameter to this method.
We can open Chrome default profile with Selenium. To get the Chrome profile path, we need to input chrome://version/ in the Chrome browser and then press enter. We need to use the ChromeOptions class to open the default Chrome profile. We need to use the add_argument method to specify the path of the Chrome profile.
We can interact with an existing browser session. This is performed by using the Capabilities and ChromeOptions classes. The Capabilities class obtains the browser capabilities with the help of the getCapabilities method.
Try this:
os.environ["webdriver.chrome.driver"] = chromedriver
options = webdriver.ChromeOptions()
options.add_argument("--user-data-dir=/Users..../Google/Chrome")
webdriver.Remote("http://192.168.1.30:4441/wd/hub",
options.to_capabilities())
And if you have your chromedriver.exe on the PATH then you should not need this part:
chromedriver = "/Users....../chromedriver"
Not sure if that works for you, but here is an example that let me start remote chrome webdriver with desired chromeOption for language:
options = webdriver.ChromeOptions()
options.add_argument("--lang=de")
chrome_remote = webdriver.Remote('http://hostname:4444/wd/hub', options.to_capabilities())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With