我正在使用Selenium 2測試基於框架的Web應用程序。這是試圖登錄用戶的簡單代碼,並且在結果頁面上切換到內容框架使用Selenium 2在Opera中測試基於框架的Web應用程序
driver.get("http://localhost/index.pl");
driver.findElement(By.name("session_username")).sendKeys("my_username");
driver.findElement(By.name("session_password")).sendKeys("my_password");
driver.findElement(By.xpath("//input[@value='log in']")).click();
driver.switchTo().frame("qabody_r_head");
這正常工作,如果我在FirefoxDriver
類型,InternetExplorerDriver
或HtmlUnitDriver
的WebDriver
派:頁面。但是,如果驅動程序是OperaDriver
類型的驅動程序,則會收到具有以下錯誤輸出的異常。
Exception in thread "main" org.openqa.selenium.NoSuchFrameException: Invalid frame name qabody_r_head
Build info: version: '2.15.0', revision: '15105', time: '2011-12-08 09:57:28'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_02'
Driver info: driver.version: unknown
at com.opera.core.systems.scope.services.ums.EcmaScriptDebugger.changeRuntime(EcmaScriptDebugger.java:431)
at com.opera.core.systems.OperaDriver$OperaTargetLocator.frame(OperaDriver.java:772)
at SeleniumTest.testLogin(SeleniumTest.java:26)
at SeleniumTest.main(SeleniumTest.java:59)
我做錯了什麼,或沒有OperaDriver的框架?