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")
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
jatx
  • 21
  • 1
  • 3
  • [This might help](https://sqa.stackexchange.com/questions/15311/adding-user-data-dir-option-to-chromedriver-makes-it-not-work-and-timeout-only). 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. –  Jul 10 '18 at 13:47

1 Answers1

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"