Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Running chromedriver with xvfb #2673

Closed
lukeis opened this issue Mar 3, 2016 · 12 comments
Closed

Running chromedriver with xvfb #2673

lukeis opened this issue Mar 3, 2016 · 12 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2673

What steps will reproduce the problem?
1. Start a xvfb server. eg. Xvfb :20
2. There is no way to set the DISPLAY environment variable for chrome like can be done
with the FirefoxBinary.

Selenium version: 2.8
OS: linux
Browser: chrome
Brower version: chrome 14.

If you want to programmatically set Firefox to use xvfb you can set the environment
variable on the firefox binary like such:

FirefoxBinary firefox = new FirefoxBinary();
firefox.setEnvironmentProperty("DISPLAY", ":20");

I have attached a patch to the ChromeDriverService to allow passing in a map of environment
variables. It would be used like below:

service = new ChromeDriverService.Builder()
        .usingChromeDriverExecutable(new File("/path/to/chromedriver"))
        .usingAnyFreePort()
        .withEnvironment(ImmutableMap.of("DISPLAY",":20"))
        .build();
service.start();

Reported by jaie.wilson on 2011-10-17 02:40:10


- _Attachment: [chromedriverservice.patch](https://storage.googleapis.com/google-code-attachments/selenium/issue-2673/comment-0/chromedriverservice.patch)_
@lukeis lukeis self-assigned this Mar 3, 2016
@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-10-17 10:15:35

  • Labels added: Browser-Chrome, Component-WebDriver, Lang-Java

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Any updates on this?

Reported by jaie.wilson on 2011-12-12 05:25:27

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm following this too. What's the status?

Reported by craig@petchell.org on 2011-12-15 05:28:13

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I've updated the patch to work with 2.15.0.
If interested I've got a bitbucket repo that has the changes in it...

https://bitbucket.org/jaiew/patched-chrome-driver/overview

https://bitbucket.org/jaiew/patched-chrome-driver/changeset/f4fc0eb8be91   has the
changes.

Reported by jaie.wilson on 2011-12-19 05:29:57

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Jason, any thoughts on the chageset in comment 4?

Reported by dawagner on 2011-12-19 11:53:36

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

That  may work, but every session launched would share a display. I'd rather see if
we can add support for this in the chromedriver server. I've got some other changes
I need to make in there anyway -- I'll try to look into it this week as things start
to slow down.

Reported by jmleyba on 2011-12-19 13:35:14

  • Status changed: Accepted
  • Labels removed: Lang-Java

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Surely this fix can go in in the mean time. This is a pain point for us, solves it nicely
and is consistent with Firefox.

There may be other reasons as well others may want to pass environment variables to
the process other than setting the DISPLAY.

Reported by craig@petchell.org on 2011-12-19 20:27:22

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I still don't think this is the appropriate fix, but I'll add it as @Beta (meaning it
could go away without notice if we find a more appropriate solution).

Reported by jmleyba on 2011-12-19 20:54:38

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This issue was closed by revision r15232.

Reported by jmleyba on 2011-12-19 21:08:18

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Appreciated. Thanks for including this.

Reported by craig@petchell.org on 2011-12-19 21:14:44

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Is this is for selenium webdriver or selenium RC? I am getting a error when executing
this program

    @Test
    public void f() throws IOException 
    {
        ChromeDriverService chromeDriverService = new ChromeDriverService.Builder()
        .usingDriverExecutable(new File("/home/nvenkat/Desktop/chromedriver"))
        .usingAnyFreePort()
        .withEnvironment(ImmutableMap.of("DISPLAY",":20"))
        .build();
        chromeDriverService.start();

        System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome-stable");
        WebDriver driver = new ChromeDriver(chromeDriverService);
    }

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited
abnormally
  (Driver info: chromedriver=2.7.236831,platform=Linux 3.2.0-58-generic-pae x86) (WARNING:
The server did not provide any stacktrace information)
Command duration or timeout: 20.19 seconds
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'nvenkat-pc', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'i386',
os.version: '3.2.0-58-generic-pae', java.version: '1.7.0_25'

Reported by nvenkat.balaji on 2014-02-07 07:37:14

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:13:58

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant