在linux上使用nightwatch运行seleniumtesting

我有一个Linux的盒子,我正在试图运行seleniumtesting(写在夜间)。 我在http://chromedriver.storage.googleapis.com/index.html?path=2.9/(linuxx64位之一)上安装了chromedriver

我也安装了独立的seleniumjar

我运行以下命令

DISPLAY=:1 xvfb-run java -jar lib/selenium-server-standalone-2.52.0.jar -Dwebdriver.chrome.driver=lib/chromedriver 

这是我的守夜configuration:

 { "src_folders": [ "tests" ], "output_folder": "reports", "custom_commands_path": "custom_commands", "custom_assertions_path": "", "page_objects_path": "", "live_output" : true, "globals_path": "globals.js", "selenium": { "start_process": true, "server_path": "lib/selenium-server-standalone-2.52.0.jar", "log_path": "", "host": "127.0.0.1", "port": 4444, "cli_args": { "webdriver.chrome.driver": "lib/chromedriver", "webdriver.chromeJenkins.driver": "../../tools/chromedriver/chromedriver", "webdriver.ie.driver": "lib/IEDriverServer_x64_2.52.2.exe", "trustAllSSLCertificates": true } }, "test_workers": { "enabled": true, "workers": "auto" }, "test_settings": { "default": { "launch_url": "", "selenium_port": 4444, "selenium_host": "localhost", "silent": true, "screenshots": { "enabled": true, "on_failure": true, "on_error": true, "path": "./screenshots" }, "end_session_on_fail": false, "desiredCapabilities": { "browserName": "chrome", "javascriptEnabled": true, "acceptSslCerts": true, "chromeOptions": { "args": [ "use-fake-device-for-media-stream", "use-fake-ui-for-media-stream" ] } } }, "jenkins" : { "selenium_port" : 4444, "selenium_host" : "127.0.0.1", "cli_args" : { "webdriver.chrome.driver" : "lib/chromedriver" }, "chromeOptions" : { "args" : ["--no-sandbox"] }, "desiredCapabilities": { "browserName": "chrome", "javascriptEnabled": true, "acceptSslCerts": true, "platform" : "LINUX", "chromeOptions" : { "args" : ["--no-sandbox"] } } } } 

然后我运行以下命令

  DISPLAY=:1 xvfb-run --server-args="-screen 0, 1366x768x24" ./nightwatch -e jenkins --test tests/blog.js 

testing开始运行,但是当我看着输出时,驱动程序被卡住在一个特定的元素。 它试图find元素,但超时。 当我在本地机器上运行testing时,我不会得到这个错误。

我在这里做错了什么?

检查您的浏览器视口大小。 它在xvfb中可能比在主屏幕上小,而且您的testing网站可能会以不同的分辨率改变行为。 看到我的第一天。

TL; DR我的chrome窗口大小相同,但打开debugging窗格更改了网站行为。