I am trying to launch a browser in BitBAr from my IDE setup. I have to bypass the proxy and then connect to remote server. After doing some google & stackoverlow help I wrote this code. But it does not seem to work with Java 11 but it connects the remote browser with Java 8. Can someone please help as I have spent lot of time undertanding the issue byt failed to get the solution
Selenium version used – 4.21.1 (used previous ones also)
Jave version (11)
The errors I get are
getMessage(): Could not start a new session. Unable to parse remote response:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Unable to parse remote response:
Caused by: org.openqa.selenium.json.JsonException: Expected to read a START_MAP but instead have: END. Last 0 characters read:
Extract of the code, cannot share the proxy and key details, so have kept some
public static void main(String[] args) throws IOException, InterruptedException, NoSuchFieldException {
MutableCapabilities capabilities = new MutableCapabilities();
// SET PROXY DETAILS
String proxyHost = "someurl.com";
int proxyPort = 8080;
String proxyUser = "proxyUSer";
String proxyPassword = "proxyPassword";
String remoteDesktopURL = "https://us-west-desktop-hub.bitbar.com/wd/hub/";
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
ClientConfig config = null;
// CONFIG TO ADD CREDENTIALS
try {
config = ClientConfig.defaultConfig()
.readTimeout(Duration.ofSeconds(90))
.authenticateAs(new UsernameAndPassword(proxyUser, proxyPassword))
.proxy(proxy)
.baseUrl(new URL(remoteDesktopURL));
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
capabilities.setCapability("platformName", "macOS");
capabilities.setCapability("browserName", "chrome");
capabilities.setCapability("browserVersion", "120");
//Setting BITBAR capabilities
HashMap<String, String> bitbarOptions = new HashMap<String, String>();
bitbarOptions.put("apiKey", "someKey");
bitbarOptions.put("osVersion", "12");
bitbarOptions.put("resolution", "2560x1920");
bitbarOptions.put("seleniumVersion", "4");
bitbarOptions.put("bitbar_testTimeout", "1800");
// Creating a RemoteWebDriver instance with Bitbar capabilities
try{
driver = RemoteWebDriver.builder()
.config(config)
.oneOf(capabilities)
.setCapability("bitbar:options", bitbarOptions)
.build();
}
catch (Exception e){
e.printStackTrace();
}
driver.get("https://www.bbc.co.uk/"); ```