0

I'm using a certain script in jupyter notebook with python3.7 and it shows me the error:

InvalidArgumentException: Message: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir

I looked for a solution and found many, tried them all but nothing worked.

I tried:

  • closing all chrome processes
  • Closing all other tabs
  • Creating a new user and using it's user-data-dir while being on default user
  • using a new user user-data-dir while being logged into it instead default browser
  • I disabled all addons except the one required for the tool

Also, there is a line : driver.set_window_size(1366, 768) It was originally set_window_size(1920, 1280) but I changed it to my actual resolution. Is it okay ?

options = webdriver.ChromeOptions()
options.add_argument(f"--user-data-dir={user_data_dir}")
options.add_argument(f'--profile-directory={profile_directory}')
options.add_argument('--blink-settings=imagesEnabled=false')
options.add_argument('--headless')
options.add_argument('--disable-gpu')
options.add_argument('window-size=10x10')
driver.set_window_position(-10000, 0)
driver.set_window_size(0, 0)
driver = webdriver.Chrome(options=options)
driver.set_window_position(-10000, 0)
driver.set_window_size(1366, 768)
driver.implicitly_wait(30)
StrikerVillain
  • 3,719
  • 2
  • 24
  • 41
Moh Zak
  • 1
  • 1
  • Does this answer your question? [InvalidArgumentException: Message: invalid argument: user data directory is already in use error using --user-data-dir to start Chrome using Selenium](https://stackoverflow.com/questions/59987080/invalidargumentexception-message-invalid-argument-user-data-directory-is-alre) – cruisepandey Sep 04 '21 at 12:28
  • Do you have this directory opened in Finder or any other app? – j.rmz87 Sep 10 '21 at 03:59

0 Answers0