I want to run Selenium test case with Chromium under Debian 6, which doesn't have any User Interface. For this I'm using 'xsimulator'. I set up my test:

public void setUp() throws Exception{ setName("test"); super.setUp("http://www.wikipedia.org/", "*googlechrome chromium- browser); }

It starts Chromium instance without any problem, but, since it's the first run of Chromium, it asks me make the default browser. Without UI (I'm on xsimulator) I can't click and make any of the choices. Actually, Chromium allows to start it without asking default browser check (argument '--no-default-browser-check'), but this only works in terminal. When I set up test like this:

super.setUp("http://www.wikipedia.org/", "*googlechrome usr/bin/chromium-browser --no-default-browser-check");

It throws null pointer exception:

java.lang.NullPointerException at org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher.createCommandArray(GoogleChromeLauncher.java:168)

Another workaround could be to make the chrome default by running it on terminal using '--make-default-browser' argument, but unfortunately this leads to 'xdg' fault:

xdg-settings: unknown desktop environment Segmentation fault

My question is: how to set up chromium browser in selenium test case with browser specific arguments like mentioned above or avoid default browser check?

有帮助吗?

解决方案

The main problem was to force Chromium start without any first run specific actions, either via Selenium or manually. I couldn't find the way to set up chromium browser in selenium test case with browser specific arguments, but I found a workaround to force Chromium to not ask me to "make Chromium the default browser".

For this:

  1. Go to Chromium profile dir (usually - /"current user"/.config/chromium/)
  2. Switch to "Default" dir
  3. Edit file "Preferences" by adding in "browser" section "check_default_browser": false,
  4. Go to /"current user"/.config/chromium and create empty file called "First Run"

This will force the Chromium start normally.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top