2

I just got some trouble when I move my automation test script using Java & Selenium, from my local env (OSX) to my server env (Ubuntu 14 without GUI of course). So this is the problem. I try to run my automation test using this command java -jar MyAutomation.jar 3 1 1 3 1 1 is just an application arguments, so there is nothing to do with it in our case. But after I ran that command, I got my java selenium try to open chrome browser via chromedriver. But unfortunately, this error message has appeared :

PAC support disabled because there is no system implementation

And another error message comes by, here we go :

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.10.267518,platform=Linux 3.13.0-36-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.54 seconds

and of course, I do not know for sure how come it is. But when I try to run in my local env with GUI (in OSX env), it runs without any problem, everything is run well. So in my short analysis, this error comes when I try to run chrome browser in non GUI.

So I try to make some changes in my linux server env. I try to install Xvfb so that my OS works as if there is a GUI control over it. I start the Xvfb by using this bash script.

I re-run my automation script, and still got the problem. For short insight, I include some snippet here of how I my automation script is.

public void execute(String username, String password){
    System.setProperty("webdriver.chrome.driver", "chromedriver");
    WebDriver driver = new ChromeDriver();

    System.out.println("Try pull all etalase");

    ServiceCommonNav.login(driver, username, password);
    ServiceCommonNav.moveTo(driver, "https://www.somewebsitetoscrap.com");

    Gson gson = new Gson();

    List<Etalase> etalases = pullEtalaseList(driver);
    SaveEtalaseRequest request = new SaveEtalaseRequest();
    request.setEtalases(etalases);

    SaveEtalaseWS ws = new SaveEtalaseWS();
    ws.call(request);

    String json = gson.toJson(etalases);
    System.out.println(json);

}

If, if i strongly required to run my scraper over this Xvfb, what is the proper way to achieve that? (So that my opened chrome browser always runs over Xvfb and work as if the browser is headless). What the step, and what code should I modified to achieve that. Very beg for your help, I just got stucked for this problem for more than a week. Geez.... :(

Thanks in advance...

otnieldocs
  • 325
  • 1
  • 5
  • 20

0 Answers0