is that possible to specify different 'user-data-dir' for each node when using selenium grid?

10/30/2019

running test framework based on Selenium grid + selenium nodes in containers; trying to have each chrome node has its own cache directory.

  • use k8s-yaml file export SELENIUM_POD_NAME for each container:

yaml file:

...
container:
  ...
  env:
    name: SELENIUM_POD_NAME
      valueFrom:
        fieldRef:
           fieldPaht: metadata.name
  ...

python code for doing such setting:

   ...
   chromeOptions = webdriver.ChromeOptions()
   chromeOptions.add_arguemnt("user-data-dir=/home/$SELENIUM_POD_NAME")

   driver=webdriver.remote('http://selenium-hub:4444/wd/hub',
          desired_capabilities=DesiredCapabilities.CHROME,
          options=chromeOptions)
   ...

looks the $SELENIUM_POD_NAME can't be understand by node correctly, only one directory created and all the data was put into /home/'$SELENIUM_POD_NAME' dir - $ didn't get parsed properly.

any suggestions? thanks.

-- Huide Yin
docker
kubernetes
selenium
webdriver

0 Answers