我有一個使用WebObjects構建的動態Web應用程序。有一個鏈接,我的測試代碼試圖找到。我在找到它之前做了一個getPageSource(),並且在下面。Selenium找到一個標籤,但點擊()不起作用?
我找到了標籤成功。然後我點擊它。什麼都沒發生。我正在尋找下一頁的標籤沒有找到。
那麼,一個標籤怎麼樣可以使它不響應點擊?沒有附加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 [email protected]
[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/[email protected]/components/driver_component.js:8444)
[java] at <anonymous class>.FirefoxDriver.prototype.findElement(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/[email protected]/components/driver_component.js:8453)
[java] at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/[email protected]/components/command_processor.js:10456)
[java] at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/[email protected]/components/command_processor.js:10461)
[java] at <anonymous class>.DelayedCommand.prototype.execute/<(file:///var/folders/oZ/oZFKAiJ8FC80oMT1b--WME+++TQ/-Tmp-/anonymous4201752404452189319webdriver-profile/extensions/[email protected]/components/command_processor.js:10401)
也許是一個提示。如果我等待一秒鐘並在相同的WebElement實例上調用click(),則會得到一個org.openqa.selenium.StaleElementReferenceException。但是我可以成功地重新找到元素(它不存在於目標頁面上)並單擊(),但仍然沒有效果。嗯.... –