收到此錯誤運行硒腳本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());
不知道如何或爲什麼,設法通過升級我的jdk到8來解決這個問題 –