1
votes

I am getting error:

Caused by: java.net.URISyntaxException: Expected authority at index 7: http://

For below code:

try 
{
    return new RemoteWebDriver(new URL("http://" + username + ":" + authkey +"@hub.crossbrowsertesting.com:80/wd/hub"), caps);
} 
catch (MalformedURLException e) 
{
    // TODO Auto-generated catch block
    e.printStackTrace();
    return null;
 }

Stack trace:

Driver info: driver.version: RemoteWebDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:622) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:155) at abc.testcase.LoginForm2.main(LoginForm2.java:45) Caused by: org.apache.http.client.ClientProtocolException at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142) at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:108) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:64) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) ... 4 more Caused by: org.apache.http.HttpException: Cannot convert host to URI: http:// at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:77) at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:77) at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183) ... 12 more Caused by: java.net.URISyntaxException: Expected authority at index 7: http:// at java.net.URI$Parser.fail(URI.java:2848) at java.net.URI$Parser.failExpecting(URI.java:2854) at java.net.URI$Parser.parseHierarchical(URI.java:3102) at java.net.URI$Parser.parse(URI.java:3053) at java.net.URI.(URI.java:588) at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:75) ... 15 more

Please help!

1
please Show the Content of the concatinated string - Jens
username:[email protected] and authkey:abc12cd34 - Prabhav
@Jens can you please check for me. - Prabhav

1 Answers

5
votes

Error got resolved just by encoding @ by %40