2011-12-07 69 views
1

我在測試帳戶創建過程時遇到問題。這裏是我的錯誤:Grails + selenium-rc - 提交AJAX表格

Object [object HTMLIFrameElement] has no method 'getCurrentWindow' 
com.thoughtworks.selenium.SeleniumException: Object [object HTMLIFrameElement] has no method 'getCurrentWindow' 
    at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97) 
    at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91) 
    at com.thoughtworks.selenium.DefaultSelenium.waitForPageToLoad(DefaultSelenium.java:635) 
    at com.thoughtworks.selenium.Selenium$waitForPageToLoad$0.call(Unknown Source) 
    at grails.plugins.selenium.SeleniumWrapper.waitForPageToLoad(SeleniumWrapper.groovy) 
    at com.thoughtworks.selenium.Selenium$waitForPageToLoad.call(Unknown Source) 
    at grails.plugins.selenium.meta.AndWaitDynamicMethod.invoke(AndWaitDynamicMethod.groovy:33) 
    at grails.plugins.selenium.SeleniumWrapper.methodMissing(SeleniumWrapper.groovy:125) 
    at tokenadmin.SignUpTests.testManualSignUp(SignUpTests.groovy:33) 

,這裏是截圖:

enter image description here

和相關代碼部分:

selenium.waitForElementPresent("css=#registerForm"); 
    selenium.type("name=name", "selenium test 1"); 
    selenium.type("name=email", emailAddress); 
    selenium.type("css=input[tabindex=\"13\"]", "123123"); 
    selenium.type("name=password1", "123123"); 
    selenium.type("css=input[tabindex=\"14\"]", "123123"); 
    selenium.type("name=password2", "123123"); 
    selenium.submitAndWait("css=#registerForm") 
    assertTrue(selenium.isTextPresent("Please confirm your e-mail address")); 

任何想法怎麼辦?

UPDATE:

我改變了一切爲localhost:8080,它突然開始工作。不知道爲什麼。

回答

1

將項目URL更改爲localhost:8080後開始工作

0

由於Javascript安全規則,您無法這樣做。本地主機上的腳本 只能訪問基於本地主機的框架。