以编程方式将EnvironmentProperty设置为ChromeDriver
我正在无头中使用 SE2 和 firefoxDriver 运行测试 环境(Xvfb)。使用 FirefoxDriver 我可以非常设置 DISPLAY 环境属性 轻松:
FirefoxBinary firefox = new FirefoxBinary();
firefox.setEnvironmentProperty("DISPLAY",":"+DISPLAY);
FirefoxProfile firefoxProfile = new ProfilesIni().getProfile(Config.webDriverFirefoxProfile);
this.webDriver = new FirefoxDriver(firefox,firefoxProfile);
如何使用 ChromeDriver 执行上述操作?
更新:似乎这还不可能做到!这里有一个与我类似的问题,其中解释了这种情况: ChromeDriver 无头
I am running tests with SE2 and firefoxDriver in a headless
enviroment(Xvfb). With FirefoxDriver I can set the DISPLAY environment property very
easily:
FirefoxBinary firefox = new FirefoxBinary();
firefox.setEnvironmentProperty("DISPLAY",":"+DISPLAY);
FirefoxProfile firefoxProfile = new ProfilesIni().getProfile(Config.webDriverFirefoxProfile);
this.webDriver = new FirefoxDriver(firefox,firefoxProfile);
How can I do the above with ChromeDriver?
UPDATE: Seems that this is not possible to do yet! There is a similar question with mine here where explains the situation: ChromeDriver Headless
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来他们已经解决了这个问题(至少现在)
这是代码中添加此方法的修订版:
http://code.google.com/p/selenium/source/detail?r=15232< /a>
looks like they've fixed this (at least for now)
Here's the revision in the code which adds this method:
http://code.google.com/p/selenium/source/detail?r=15232
另一种非编程方法,转到 /etc/chromium/default (或 /etc/chromium-browser/default 或类似的,取决于发行版)并在那里设置显示:
another non-programmatic approach, go to /etc/chromium/default (or /etc/chromium-browser/default or similar, depends on distribution) and set display there :