selenium-rs icon indicating copy to clipboard operation
selenium-rs copied to clipboard

cannot run tests

Open globalworming opened this issue 4 years ago • 5 comments

hi

i followed the instructions, selenium server is running

$ java -jar selenium-server-standalone-3.141.59.jar 
12:34:12.751 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
12:34:12.830 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-07-02 12:34:12.912:INFO::main: Logging initialized @484ms to org.seleniumhq.jetty9.util.log.StdErrLog
12:34:13.237 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
12:34:13.330 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444

and chromedriver is in the PATH

when executing any test, it fails with status 500 when establishing a session

thread 'test_get_title' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Status(500), "http://localhost:4444/wd/hub/session/")', tests/webdriver_tests.rs:47:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   5: std::io::Write::write_fmt
             at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7/src/libstd/io/mod.rs:1504
   6: std::io::impls::<impl std::io::Write for alloc::boxed::Box<W>>::write_fmt
             at src/libstd/io/impls.rs:156
   7: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   8: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   9: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
  10: std::panicking::default_hook
             at src/libstd/panicking.rs:215
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:511
  12: rust_begin_unwind
             at src/libstd/panicking.rs:419
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:111
  14: core::option::expect_none_failed
             at src/libcore/option.rs:1268
  15: core::result::Result<T,E>::unwrap
             at /home/wormi/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/result.rs:1005
  16: webdriver_tests::test_get_title
             at tests/webdriver_tests.rs:47
[...]

selenium output just says

12:45:18.160 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome"
}
12:45:18.161 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)

any idea what i am doing wrong or how to debug?

globalworming avatar Jul 02 '20 10:07 globalworming

I am also getting the same error.

I doubt localhost below routes works for selenium webdriver - http://localhost:4444/wd/hub/session/ http://localhost:4444/wd/hub/session/<session_id>/url etc ..

in webdriver.rs looks like below code is trying the session route while constructing url. let url = construct_url(vec!["session/"]);

I am not sure how these "http://localhost:4444/wd/hub/session/<session_id>/url " works ?

let url = construct_url(vec![ "session/", &(self.session_id.clone().unwrap() + "/"), "url", ]);

davnav avatar Aug 31 '20 02:08 davnav

weird..

just reopened the project in my IDE after 2 months without touching anything in between. Started selenium and ran the tests: success :heavy_check_mark:

Sorry @davnav I cannot reproduce it anymore..

globalworming avatar Aug 31 '20 08:08 globalworming

@globalworming Which version of chromedriver are you using? I'm using the latest version (of chromedriver) and I'm seeing the same 500 error on all tests.

$ chromedriver --version
ChromeDriver 87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280@{#1761})

blesson3 avatar Jan 20 '21 22:01 blesson3

don't know which version i was running at that time :)

globalworming avatar Jan 20 '21 22:01 globalworming

No worries. I figured out that I had to have the Chrome and chromedriver using the same versions. I'm now using both Chrome and chromedriver on 88.0.4324.96 and no longer getting the Error(Status(500), "http://localhost:4444/wd/hub/session/" errors.

I am though getting the error Error(Json (Error ("invalid type: null, expected a string", line: 3, column: 19)) (issues #35 and #34), but that may be outside the scope of this issue.

blesson3 avatar Jan 22 '21 23:01 blesson3