Categories
Python Answers

How to load default profile in Chrome using Python Selenium Webdriver?

Spread the love

Sometimes, we want to load default profile in Chrome using Python Selenium Webdriver.

In this article, we’ll look at how to load default profile in Chrome using Python Selenium Webdriver.

How to load default profile in Chrome using Python Selenium Webdriver?

To load default profile in Chrome using Python Selenium Webdriver, we can use the ChromeOptions object.

For instance, we write

from selenium import webdriver

options = webdriver.ChromeOptions() 
options.add_argument("user-data-dir=C:\\Path")
w = webdriver.Chrome(executable_path="C:\\Users\\chromedriver.exe", chrome_options=options)

to create a ChromeOptions object.

And then we call add_argument to set some options for Chrome.

Next, we create a Chrome object with the executable_path of the Chrome driver and the options ChromeOptions object to set the options when running Chrome.

Conclusion

To load default profile in Chrome using Python Selenium Webdriver, we can use the ChromeOptions object.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *