java.net.URISyntaxException:索引7处的预期权限:http://

时间:2017-06-08 10:41:39

标签: java selenium

我收到错误:

  

引起:java.net.URISyntaxException:索引7处的预期权限:   HTTP://

以下代码:

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;
 }

堆栈追踪:

  

驱动程序信息:driver.version:RemoteWebDriver         在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:622)         在org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)         在org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:128)         在org.openqa.selenium.remote.RemoteWebDriver。(RemoteWebDriver.java:155)         at abc.testcase.LoginForm2.main(LoginForm2.java:45)       引起:org.apache.http.client.ClientProtocolException         在org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)         在org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)         在org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)         在org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142)         在org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88)         在org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:108)         在org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:64)         在org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)         在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)         ......还有4个       引起:org.apache.http.HttpException:无法将主机转换为URI:http://         在org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:77)         在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个       引起:java.net.URISyntaxException:索引7处的预期权限:http://         在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)         在java.net.URI。(URI.java:588)         在org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:75)         ......还有15个

请帮忙!

1 个答案:

答案 0 :(得分:4)

仅通过编码@ by%40

解决了错误