Skip to content Skip to sidebar Skip to footer

Selenium Chrome Attach Default Profile

i am using python ana selenium, to automate some process, but couldnt attached selenium to default chrome profile i tried with, capability = webdriver.DesiredCapabilities.CHROME s

Solution 1:

Don't just copy/paste something straight off the website! Have a look into that folder yourself, does it have anything in it?! My guess is no. This is why when you leave that bit off, it works fine, because it's looking for Chrome where it should exist!

Any way, more to the point you are using it wrongly!

If you want to give Selenium a different profile to use for Chrome, then you need to use the options class:

https://code.google.com/p/selenium/source/browse/py/selenium/webdriver/chrome/options.py

You want the add_argument function.

Why?

This is because to give Chrome another profile to use, you need to launch Chrome with a specific command line (specifically --user-data-dir):

http://www.chromium.org/user-experience/user-data-directory

The add_argument function exposes the ability to add command line switches.

So if you use the add_argument function, Selenium will simply pass whatever you give it, down to Chrome as being part of it's command line switches.

Solution 2:

To find out where your chrome profile is located start chrome and type

chrome://version

in the address bar. Under "Profile Path:" you'll see the location of the profile you're currently using. For example:

~:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default

Post a Comment for "Selenium Chrome Attach Default Profile"