我想手动输入验证码文本,以便如何为此编写代码?
这是我的代码:
driver.findElement(By.name("/atg/commerce/order/purchase/CommitOrderFormHandler.userCaptcha")).sendKeys(captcha);
我收到以下错误:
Element is not currently visible and so may not be interacted with Command duration or timeout: 9 milliseconds Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15' System info: host: 'WID1376', ip: '172.21.22.76', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_35' Session ID: 65dab209-84aa-436a-915f-7a52174405a5 Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=23.0, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
答案 0 :(得分:0)
如果要手动输入值...放置显式等待(例如:thread.sleep(20000);)并在20秒内手动输入验证码文本。这可能对你有所帮助。如果没有阅读TDHM和olyv提供的链接