我有一个使用 WebObjects 构建的动态 Web 应用程序。我的测试代码试图找到一个链接。我在找到它之前做了一个 getPageSource() ,如下所示。
我成功找到了标签。然后我点击它。什么都没发生。找不到我在下一页上寻找的标签。
那么,一个标签如何让它不响应点击呢?它没有附加js。它在一个跨度内并围绕一个图像,但仅此而已。
当测试代码执行完毕后,我可以手动点击链接,我会看到下一页。最近怎么样?有任何想法吗?
[java] [1374173126242]: Going to Schedule page
[java] [1374173126260]:
[java] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
[java] <html xmlns="http://www.w3.org/1999/xhtml"><head>
[java] <meta content="text/html; charset=utf-8" http-equiv="content-type" />
[java] <meta content="COM" name="keywords" />
[java] <title>APP!</title>
[java] <link href="/cgi-bin/WebObjects/APP.woa/_wr_/wodata=/Users/ME/Projects/APP/WebServerResources/APP/login.css" type="text/css" rel="stylesheet" />
[java]
[java] <link href="/cgi-bin/WebObjects/APP.woa/_wr_/wodata=/Users/ME/Projects/APP/WebServerResources/APP/APP.css" type="text/css" rel="stylesheet" />
[java]
[java] </head>
[java] <body>
[java]
[java] ( some bits removed . . . )
[java] <div id="landing_page_main" class="welcomeBox">
[java] <div class="main_cont">
[java] <div class="logo"><img src="/cgi-bin/WebObjects/APP.woa/_wr_/wodata=/Users/ME/Projects/APP/WebServerResources/APP/APP-live.png" alt="APP LIVE" /></div>
[java] <div class="table">
[java] <table width="100%" cellspacing="0" cellpadding="0" border="0">
[java] <tbody><tr>
[java] <td valign="middle" align="center">
[java] <span title="Access My Schedule"><a name="19" class="access_my_schedule_link" href="/cgi-bin/WebObjects/APP.woa/wo/Tbrd5n8SsAGIL22d7hkPCM/2.19"><img width="74" border="0" height="64" src="/cgi-bin/WebObjects/APP.woa/_wr_/wodata=/Users/ME/Projects/APP/WebServerResources/APP/arrowRight.png" ismap="ismap" /></a></span>
[java] </td>
[java] </tr>
[java] </tbody></table>
[java] </div>
[java] </div>
[java] </div>
[java]
[java] </body></html>
[java] [1374173126320]: found element:
[java] [[FirefoxDriver: firefox on MAC (7ac7e5e2-d4e2-334b-9d99-2e6ddb7b7439)] -> class name: access_my_schedule_link]
[java] [1374173126332]: element enabled? true
[java] [1374173126342]: element selected? false
[java] [1374173126362]: element displayed? true
[java] [1374173126389]: element location: (620, 265)
[java] [1374173126404]: element tagName: a
[java] [1374173126431]: element text:
[java] Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out after 10 seconds waiting for APPLiveDriver$4@337b4703
[java] Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
[java] System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.6.8', java.version: '1.6.0_51'
[java] Driver info: driver.version: APPLiveDriver
[java] at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:259)
[java] at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:228)
[java] at APPLiveDriver.scheduleAndBack(Unknown Source)
[java] at APPLiveDriver.main(Unknown Source)
[java] Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"class name","selector":"breadcrumb_home_link"}
[java] Command duration or timeout: 9 milliseconds
[java] For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
[java] Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
[java] System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.6.8', java.version: '1.6.0_51'
[java] Session ID: 7ac7e5e2-d4e2-334b-9d99-2e6ddb7b7439
[java] Driver info: org.openqa.selenium.firefox.FirefoxDriver
[java] Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=21.0, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
[java] at sun.reflect.GeneratedConstructorAccessor14.newInstance(Unknown Source)
[java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[java] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[java] at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
[java] at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
[java] at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
[java] at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
[java] at org.openqa.selenium.remote.RemoteWebDriver.findElementByClassName(RemoteWebDriver.java:388)
[java] at org.openqa.selenium.By$ByClassName.findElement(By.java:371)
[java] at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
[java] at APPLiveDriver$4.apply(Unknown Source)
[java] at APPLiveDriver$4.apply(Unknown Source)
[java] at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
[java] ... 2 more
[java] Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"class name","selector":"breadcrumb_home_link"}
[java] Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
[java] System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.6.8', java.version: '1.6.0_51'
[java] Driver info: driver.version: unknown
[java] at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8444)
[java] at <anonymous class>.FirefoxDriver.prototype.findElement(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8453)
[java] at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10456)
[java] at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10461)
[java] at <anonymous class>.DelayedCommand.prototype.execute/<(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10401)