javax.net.ssl.SSLException:收到致命警报:PROTOCOL_VERSION与硒

问题描述:

收到此错误运行硒脚本javax.net.ssl.SSLException:收到致命警报:PROTOCOL_VERSION与硒

org.openqa.selenium.WebDriverException:javax.net.ssl.SSLException:收到致命警报: PROTOCOL_VERSION

堆栈跟踪如下:

驱动程序信息:driver.version:HtmlUnitDriver 在sun.security.ssl.Alerts.getSSLException(快讯.java:208) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1979) at sun.security.ssl.SSLSocketImpl .readRecord(SSLSocketImpl.java:1086) 在sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332) 在sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359) 在sun.security .ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343) 在org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394) 在org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket (SSLConnectionSocketFactory.java:353) at com.gargoylesoftware.htmlunit.httpclient。 HtmlUnitSSLConnectionSocketFactory.connectSocket(HtmlUnitSSLConnectionSocketFactory.java:189) 在org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134) 在org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager。的java:353) 在org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) 在org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) 在org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http。 impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.a pache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) at com.gargoylesoftware.htmlunit.HttpWebConnection。的GetResponse(HttpWebConnection.java:179) 在com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1321) 在com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1238) 在com.gargoylesoftware。 htmlunit.WebClient.getPage(WebClient.java:346) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415) at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:541) at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:530) 在com.mimos.performance.PerfTest.PerfTest(PerfTest.java:34)

生成信息:版本: '2.48.2',修订版: '41bccdd10cf2c0560f637404c2d96164b67d9d67',时间:“2015年10月9日13 :08:06'

Java版本 “1.7.0_79” 的Java(TM)SE运行时环境(建立1.7.0_79-B15) 爪哇热点(TM)64位服务器VM(建立24.79-B02,混合模式)

HtmlUnitDriver driver = new HtmlUnitDriver();   
    driver.get(url); 
    WebElement passwordLogo = driver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div/ul/li/a")); 
    passwordLogo.click(); 
    WebElement userID = driver.findElement(By.xpath("/html/body/div/form[1]/input[1]")); 
    userID.sendKeys(username); 
    WebElement next = driver.findElement(By.xpath("/html/body/div/form[1]/input[2]")); 
    next.click(); 
    WebElement password = driver.findElement(By.xpath("/html/body/div/form[1]/div/input[1]")); 
    password.sendKeys(password); 
    WebElement login = driver.findElement(By.xpath("/html/body/div/form[1]/div/input[3]")); 
    login.click(); 
    System.out.println(driver.getTitle()); 

早上好。可能与javax.net.ssl.SSLException: Received fatal alert: protocol_version

这似乎是一个协议版本不匹配,当有客户端和服务器使用的SSL协议版本之间存在不匹配此异常通常发生。你的客户应该使用服务器支持的协议版本。

+0

不知道如何或为什么,设法通过升级我的jdk到8来解决这个问题 –