2017-09-25 36 views
0

机详细不能硒独立创建FF /铬会议

AME="Amazon Linux AMI" 
VERSION="2017.03" 
ID="amzn" 
ID_LIKE="rhel fedora" 
VERSION_ID="2017.03" 
PRETTY_NAME="Amazon Linux AMI 2017.03" 
ANSI_COLOR="0;33" 
CPE_NAME="cpe:/o:amazon:linux:2017.03:ga" 
HOME_URL="http://aws.amazon.com/amazon-linux-ami/" 

我是新来硒独立。我已经下载了最新的Java版本,单机使用NPM,XVFB并正尝试使用以下命令在独立开启后创建会话:

sudo xvfb-run --server-args="-screen 0, 1366x768x24" selenium-standalone start -- -debug 

还请注意,我用的集线器和节点尝试此也试图在本地客户端上使用C#运行Selenium测试。

当我尝试创建我收到此错误Chrome的会话(轮询将持续几秒钟):

DEBUG - Waiting for [http://localhost:29837/status] 
DEBUG - Polling http://localhost:29837/status 
/usr/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.32- 
x64-chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory 
DEBUG - Polling http://localhost:29837/status 
DEBUG - Polling http://localhost:29837/status 
DEBUG - Polling http://localhost:29837/status 
ERROR - org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127) 
^C/usr/bin/xvfb-run: line 171: kill: (6252) - No such process 

当试图创建一个Firefox会话:

14:30:26.416 INFO - Binding default provider to: org.openqa.selenium.chrome.ChromeDriverService 
14:30:26.418 INFO - Found handler: [email protected] 
14:30:26.418 INFO - /session: Executing POST on /session (handler: BeginSession) 
14:30:26.442 DEBUG - Memory-based payload for: {desiredCapabilities={browserName=firefox}} 
14:30:26.453 INFO - Capabilities are: Capabilities {browserName=firefox} 
14:30:26.457 INFO - Capabilities {browserName=firefox} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService) 
14:30:26.458 INFO - Capabilities {browserName=firefox} matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) 
1506349826497 geckodriver INFO geckodriver 0.18.0 
1506349826501 geckodriver INFO Listening on 127.0.0.1:5611 
DEBUG - CookieSpec selected: default 
DEBUG - Auth cache not set in the context 
DEBUG - Connection request: [route: {}->http://localhost:5611][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 
DEBUG - Connection leased: [id: 0][route: {}->http://localhost:5611][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 
DEBUG - Opening connection {}->http://localhost:5611 
DEBUG - Connecting to localhost/127.0.0.1:5611 
DEBUG - Connection established 127.0.0.1:59276<->127.0.0.1:5611 
DEBUG - http-outgoing-0: set socket timeout to 10800000 
DEBUG - Executing request POST /session HTTP/1.1 
DEBUG - Target auth state: UNCHALLENGED 
DEBUG - Proxy auth state: UNCHALLENGED 
DEBUG - http-outgoing-0 >> POST /session HTTP/1.1 
DEBUG - http-outgoing-0 >> Content-Type: application/json; charset=utf-8 
DEBUG - http-outgoing-0 >> Content-Length: 49 
DEBUG - http-outgoing-0 >> Host: localhost:5611 
DEBUG - http-outgoing-0 >> Connection: Keep-Alive 
DEBUG - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_131) 
DEBUG - http-outgoing-0 >> Accept-Encoding: gzip,deflate 
DEBUG - http-outgoing-0 >> "POST /session HTTP/1.1[\r][\n]" 
DEBUG - http-outgoing-0 >> "Content-Type: application/json; charset=utf-8[\r][\n]" 
DEBUG - http-outgoing-0 >> "Content-Length: 49[\r][\n]" 
DEBUG - http-outgoing-0 >> "Host: localhost:5611[\r][\n]" 
DEBUG - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]" 
DEBUG - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_131)[\r][\n]" 
DEBUG - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]" 
DEBUG - http-outgoing-0 >> "[\r][\n]" 
DEBUG - http-outgoing-0 >> "{"desiredCapabilities":{"browserName":"firefox"}}" 
DEBUG - http-outgoing-0 << "HTTP/1.1 500 Internal Server Error[\r][\n]" 
DEBUG - http-outgoing-0 << "Connection: close[\r][\n]" 
DEBUG - http-outgoing-0 << "Content-Type: application/json; charset=utf-8[\r][\n]" 
DEBUG - http-outgoing-0 << "Cache-Control: no-cache[\r][\n]" 
DEBUG - http-outgoing-0 << "Content-Length: 1337[\r][\n]" 
DEBUG - http-outgoing-0 << "Date: Mon, 25 Sep 2017 14:30:27 GMT[\r][\n]" 
DEBUG - http-outgoing-0 << "[\r][\n]" 
DEBUG - http-outgoing-0 << "{"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":"stack backtrace:\n 0:   0x5787ed - backtrace::backtrace::trace::h59229d13f6a8837d\n 1:   0x578942 - backtrace::capture::Backtrace::new::h23089c033eded8f0\n 2:   0x44da3d - geckodriver::marionette::MarionetteHandler::create_connection::h6f7058fccafe4367\n 3:   0x425c32 - <webdriver::server::Dispatcher<T, U>>::run::h8f5348b8f5f7c053\n 4:   0x40b22c - std::panicking::try::do_call::hb67c6fb6bcd96195\n 5:   0x5dc20a - panic_unwind::__rust_maybe_catch_panic\n      at /checkout/src/libpanic_unwind/lib.rs:98\n 6:   0x41b943 - <F as alloc::boxed::FnBox<A>>::call_box::h4100941edc372034\n 7:   0x5d48a4 - alloc::boxed::{{impl}}::call_once<(),()>\n      at /checkout/src/liballoc/boxed.rs:650\n       - std::sys_common::thread::start_thread\n      at /checkout/src/libstd/sys_common/thread.rs:21\n       - std::sys::imp::thread::{{impl}}::new::thread_start\n      at /checkout/src/libstd/sys/unix/thread.rs:84"}}" 
DEBUG - http-outgoing-0 << HTTP/1.1 500 Internal Server Error 
DEBUG - http-outgoing-0 << Connection: close 
DEBUG - http-outgoing-0 << Content-Type: application/json; charset=utf-8 
DEBUG - http-outgoing-0 << Cache-Control: no-cache 
DEBUG - http-outgoing-0 << Content-Length: 1337 
DEBUG - http-outgoing-0 << Date: Mon, 25 Sep 2017 14:30:27 GMT 
DEBUG - http-outgoing-0: Close connection 
DEBUG - Connection discarded 
DEBUG - Connection released: [id: 0][route: {}->http://localhost:5611][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 

在试图运行此命令来安装最新的Stable Google Chrome:

sudo yum -y localinstall google-chrome-stable_current_x86_64.rpm 

wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm 

我得到这个错误:

Error: Package: google-chrome-stable-61.0.3163.100-1.x86_64 (/google-chrome-stable_current_x86_64) 
      Requires: libgdk-3.so.0()(64bit) 
Error: Package: google-chrome-stable-61.0.3163.100-1.x86_64 (/google-chrome-stable_current_x86_64) 
      Requires: libXss.so.1()(64bit) 
Error: Package: google-chrome-stable-61.0.3163.100-1.x86_64 (/google-chrome-stable_current_x86_64) 
      Requires: libatk-1.0.so.0()(64bit) 
Error: Package: google-chrome-stable-61.0.3163.100-1.x86_64 (/google-chrome-stable_current_x86_64) 
      Requires: libgdk_pixbuf-2.0.so.0()(64bit) 
Error: Package: google-chrome-stable-61.0.3163.100-1.x86_64 (/google-chrome-stable_current_x86_64) 
      Requires: libgconf-2.so.4()(64bit) 
Error: Package: google-chrome-stable-61.0.3163.100-1.x86_64 (/google-chrome-stable_current_x86_64) 
      Requires: libgtk-3.so.0()(64bit) 
Error: Package: google-chrome-stable-61.0.3163.100-1.x86_64 (/google-chrome-stable_current_x86_64) 
      Requires: xdg-utils 
You could try using --skip-broken to work around the problem 
You could try running: rpm -Va --nofiles --nodigest 

有没有人碰到这个问题,无论如何都要解决这个问题?请让我知道,如果你有任何问题。

+0

用Firefox,它看起来像问题在于它无法找到二进制文件,使用chrome可以解决安装chrome之前必须解决的各种库问题,并且能够执行chrome驱动程序。这与硒或c#无关 –

回答

0

我无法在Linux AMI上安装这些库,但我最终所做的是将它安装在Ubuntu实例上。这使得使用以下文档进行了非常简单的安装: https://www.npmjs.com/package/selenium-standalone

但是,我收到了一个与我的Ubuntu Linux的二进制错误。问题是,我没有在我的Linux机器安装了浏览器,我能够这样做,这里使用说明:使用火狐 https://askubuntu.com/questions/510056/how-to-install-google-chrome

作品也很好:

#install firefox browser 
sudo apt-get install firefox