日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > java >内容正文

java

selenium java 验证码_如何使用Selenium WebDriver和Java从图像(验证码)中读取文本

發(fā)布時(shí)間:2025/4/16 java 65 豆豆
生活随笔 收集整理的這篇文章主要介紹了 selenium java 验证码_如何使用Selenium WebDriver和Java从图像(验证码)中读取文本 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我有注冊(cè)網(wǎng)頁(yè),但在最后驗(yàn)證碼顯示..

我無法從圖像中讀取文本.我要提一下代碼和輸出..

@Test

public void loginTest() throws InterruptedException {

System.out.println("Testing");

driver.get("https://customer.onlinelic.in/ForgotPwd.htm");

WebElement element = driver.findElement(By.xpath("//*[@id='forgotPassword']/table/tbody/tr[5]/td[3]/img"));

System.out.println(" get the instance ");

String elementTest = element.getAttribute("src");

System.out.println("Element : " + elementTest);

}

輸出:錯(cuò)誤

Exception in thread “main” org.openqa.selenium.NoSuchElementException:

Unable to locate element:

{“method”:”xpath”,”selector”:”//[@id=’forgotPassword’]/table/tbody/tr[5]/td[3]/img”}

Command duration or timeout: 60.02 seconds For documentation on this error, please visit:

07000 Build info:

version: ‘2.35.0’, revision: ‘8df0c6b’, time: ‘2013-08-12 15:43:19’

System info: os.name: ‘Windows 7’, os.arch: ‘a(chǎn)md64’, os.version:

‘6.1’, java.version: ‘1.6.0_26’ Session ID:

5f5b2e1a-56a4-49ad-8fd3-2870747a7768 Driver info:

org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=XP,

acceptSslCerts=true, javascriptEnabled=true, browserName=firefox,

rotatable=false, locationContextEnabled=true, version=23.0.1,

cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true,

browserConnectionEnabled=true, nativeEvents=true,

webStorageEnabled=true, applicationCacheEnabled=true,

takesScreenshot=true}] at

sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at

sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at

org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)

at

org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)

at

org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)

at

org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)

at

org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:404)

at org.openqa.selenium.By$ByXPath.findElement(By.java:344) at

org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)

at seleniumtest.CaptchaTest.loginTest(CaptchaTest.java:41) at

seleniumtest.CaptchaTest.main(CaptchaTest.java:59) Caused by:

org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable

to locate element:

{“method”:”xpath”,”selector”:”//[@id=’forgotPassword’]/table/tbody/tr[5]/td[3]/img”}

Build info: version: ‘2.35.0’, revision: ‘8df0c6b’, time: ‘2013-08-12

15:43:19’ System info: os.name: ‘Windows 7’, os.arch: ‘a(chǎn)md64’,

os.version: ‘6.1’, java.version: ‘1.6.0_26’ Driver info:

driver.version: unknown at .FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/lukup/AppData/Local/Temp/anonymous4043037924964932185webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8880)

at .fxdriver.Timer.prototype.setTimeout/<.notify>

總結(jié)

以上是生活随笔為你收集整理的selenium java 验证码_如何使用Selenium WebDriver和Java从图像(验证码)中读取文本的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。