stevepryde/thirtyfour

Connecting to Browserstack-API fails with err: webdriver server gave non-conformant response: Object {"message": String("Session not started or terminated")}

juma121 opened this issue · 3 comments

use serde_json::json;
use thirtyfour::prelude::*;

let mut capabilities = Capabilities::new();

let b_stack_options = serde_json::from_str(r#"
    {
        "osVersion" : "11",
        "buildName" : "browserstack-build-1",
        "sessionName" : "test-session",
        "userName" : "BROWSERSTACK_USERNAME",
        "accessKey" : "BROWSERSTACK_ACCESS_KEY",
        "os" : "Windows"
    }
"#,
)
.unwrap();

capabilities.insert("browserName".to_string(), json!("chrome"));
capabilities.insert("browserVersion".to_string(), json!("103.0"));
capabilities.insert("os".to_string(), json!("Windows"));
capabilities.insert("osVersion".to_string(), json!("11"));
capabilities.insert("buildName".to_string(), json!("browserstack-build-1"));
capabilities.insert("sessionName".to_string(), json!("test-session"));
capabilities.insert("bstack:options".to_string(), b_stack_options);

let driver = WebDriver::new("https://hub.browserstack.com/wd/hub", capabilities.clone()).await.unwrap();

Running the following code I get the following error message back from Browserstack:

webdriver server gave non-conformant response: Object {"message": String("Session not started or terminated")}

Try dropping the /wd/hub from the url. For later selenium versions that isn't needed

Also check if the behaviour is the same with fantoccini (I assume it is) and if so, consider creating an issue there.

Thanks for the the quick advice. Removing the path "/wd/hub" path did not work unfortunately. I created an issue in the fantoccini crate and contacted Browserstack support. It seems that Browserstack-API is not compatible with fantoccini rust-project at this point in time. I will post the answer here if I find out more.