【问题标题】:java.net.URISyntaxException: Expected authority at index 7: http://java.net.URISyntaxException:索引 7 处的预期权限:http://
【发布时间】:2017-06-08 10:41:39
【问题描述】:

我收到错误:

原因: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) 在 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) 在 org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124) 在 org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183) ... 12 更多 引起:java.net.URISyntaxException:索引 7 处的预期权限:http:// 在 java.net.URI$Parser.fail(URI.java:2848) 在 java.net.URI$Parser.failExpecting(URI.java:2854) 在 java.net.URI$Parser.parseHierarchical(URI.java:3102) 在 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 更多

请帮忙!

【问题讨论】:

标签: java selenium


【解决方案1】:

仅通过 %40 编码 @ 即可解决错误

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 2019-05-06
    • 2012-11-20
    相关资源
    最近更新 更多