我有注册网页,但在最后一个验证码显示..
我无法从图像中读取文本。我将提到代码和输出..
@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);
}
输出:错误
线程“main” org.openqa.selenium.NoSuchElementException 中的异常:无法找到元素:{“method”:“xpath”,“selector”:“// [@id='forgotPassword']/table/tbody/tr[ 5]/td[3]/img"} 命令持续时间或超时:60.02 秒有关此错误的文档,请访问: http ://seleniumhq.org/exceptions/no_such_element.html构建信息:版本:'2.35.0',修订:'8df0c6b',时间:'2013-08-12 15:43:19' 系统信息:os.name:'Windows 7',os.arch:'amd64' , os.version: '6.1', java.version: '1.6.0_26' 会话 ID: 5f5b2e1a-56a4-49ad-8fd3-2870747a7768 驱动程序信息: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=XP, acceptSslCerts =true,javascriptEnabled=true,browserName=firefox,rotatable=false,locationContextEnabled=true,版本=23.0.1,cssSelectorsEnabled=true,databaseEnabled=true,handlesAlerts=true,browserConnectionEnabled=true,nativeEvents=true,webStorageEnabled=true,applicationCacheEnabled =true,takeScreenshot=true}] 在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 在 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) 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554) 在 org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) 在 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) 在 seleniumtest 的 org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)。CaptchaTest.loginTest(CaptchaTest.java:41) at seleniumtest.CaptchaTest.main(CaptchaTest.java:59) 原因:org.openqa.selenium.remote.ErrorHandler$UnknownServerException: 无法定位元素:{"method":"xpath ","选择器":"//[@id='forgotPassword']/table/tbody/tr[5]/td[3]/img"} 构建信息:版本:'2.35.0',修订:'8df0c6b',时间:'2013-08- 12 15:43:19' 系统信息:os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.6.0_26' 驱动程序信息:driver.version :在 .FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/lukup/AppData/Local/Temp/anonymous4043037924964932185webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8880) 处未知。 fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Users/lukup/AppData/Local/Temp/anonymous4043037924964932185webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:396)