2

Default options for chrome driver in selenium don't work. I have to pass these arguments:

            '--headless',
            '--no-sandbox',
            '--disable-dev-shm-usage'

But I don't want to pass them on all clients, I want to set them on server.

According to this topic: Passing options to chrome driver selenium

... trying this:

xvfb-run -a java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone.jar -Dwebdriver.chrome.args="--headless"

... ang got:

Exception in thread "main" com.beust.jcommander.ParameterException: Was passed main parameter '-Dwebdriver.chrome.args=--headless' but no main parameter was defined in your arg class

What system arguments should I pass to java?

kz_sergey
  • 677
  • 5
  • 19
  • Use `xvfb-run -a java -Dwebdriver.chrome.args="--headless" -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/local/bin/selenium-server-standalone.jar`. ie. Pass the system properties to the java command and not as arguments to the main class of the JAR. – Dakshinamurthy Karra Sep 12 '18 at 07:38
  • No error, but no effect. Looks like webdriver.chrome.args are ignored. – kz_sergey Sep 12 '18 at 08:00
  • You wrote that you don't want to set the options on the clients. Why is that? Can't you use https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/chrome/ChromeDriver.html#ChromeDriver-org.openqa.selenium.chrome.ChromeOptions-? Works perfectly okay for me when creating the WebDriver instance. – Piohen Sep 12 '18 at 08:52
  • Piohen, I am using php facebook webdriver. 3 client scripts are already running in production. I have to refactor their code to pass options. But I don't need any options, this is a workaround. It is the better way to do this workaround in server config, not in repository. – kz_sergey Sep 12 '18 at 09:24
  • Ah, sorry. Somehow I assumed this is Java. Good luck then! – Piohen Sep 12 '18 at 09:42
  • On server side this is Java and my question is about it ) – kz_sergey Sep 12 '18 at 10:59

0 Answers0