2

I am on Mac OS X using selenium with python 3.6.3. Im using this code, but browser Google chrome closes immediately after being launched with selenium I start this code, Google chrome opens new windows with Default profile, but chrome wont open the url google.com.

Whats problem with code? Thanks for the help!

FILE_NAME_PROFILE = '/Users/User/Library/Application Support/Google/Chrome'
options = webdriver.ChromeOptions()
options.add_argument('--user-data-dir='+FILE_NAME_PROFILE)
driver = webdriver.Chrome('assets/chromedriver', chrome_options=options)
driver.get("https://google.com")
1
  • This might help. Having Chrome open as you run this code won't work as intended. Make sure you've closed all instances of Chrome before executing this code. Commented Jul 10, 2018 at 13:47

1 Answer 1

4

I am using two arguments and work well in development

"user-data-dir=C:\Users\NameUser\AppData\Local\Google\Chrome\User Data"

"profile-directory=Default"

If you want use another profile (not default) you have to create it and only you have to change the second argument. All profiles are stored in 'User Data' folder

"profile-directory=Profile 1"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.