# Selenium, user data dir , chrome profile, custom profile, remote ChromeDriver

760 Views Asked by At

I'm facing an issue with --user-data-dir.

The following code it's working without any issues if I'm running selenium on a local machine/ ChromeDriver and the Profile path is located within the same machine.

Here is the code:

 `options1.add_argument('--user-data-dir=/tmp/chrome')
  options1.add_argument('--profile-directory=Profile 1') 
self.driver = webdriver.chrome(
command_executor="http://134.2000000.129:4444/wd/hub",
desired_capabilities=capabilities,
options=options1)` 
  

However, I'm facing an issue when I'm running it on docker/container,

ChromeDriver creating multiple: Ex:

  1. /tmp/.google

When I'm running --user-data-dir on a none existed path the System creates and uses it as the default profile path.

But it fails if --user-data-dir is directed to a custom profile.

Here is the code:

That works if there is no Directory as "/chrome:" it will create the Dir and map the Default profile. |

   `options1.add_argument('--user-data-dir=/tmp/chrome:')
    options1.add_argument('--profile-directory=Profile 1') 
self.driver = webdriver.Chrome(

                   options=chrome_options, desired_capabilities=capabilities)` 
0

There are 0 best solutions below