我的项目未通过硒测试
seleniumconfig.groovy有以下代码:
selenium {
slow = true
singleWindow = true
browser = "*iexploreproxy"
url = null
defaultTimeout = 60000
windowMaximize = false
screenshot {
dir = "./target/test-reports/screenshots"
onFail = false
}
server {
host = "localhost"
port = 4444
}
}
NewTests.groovy文件包含以下代码:
package gtunes
import grails.plugins.selenium.*
import org.junit.*
import static org.junit.Assert.*
import static org.hamcrest.Matchers.*
@Mixin(SeleniumAware)
class NewTests {
class HomepageTests extends GroovyTestCase {
void testHomepageLoads() {
selenium.openAndWait "http://www.facebook.com/login.php"
assertTrue selenium.isTextPresent("facebook")
}
}
运行命令"测试应用程序是:
30000ms后超时com.thinkworks.selenium.SeleniumException:30000ms后超时网址:com.thinkworks.selenium.HttpCommandProcessor.tthrowAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)网址:com.thingworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)在grails.plugins.SeleniumWrapper.open(SeleniumWrapper.groovy:53)位于grails.plugins.selene.meta.AndWaitDynamicMethod.ioke(AndWaitDynomicMethod.groovy:32)grails.plugins.SeleniumWrapper.methodMissing(SeleniumWrapper.groovy:125)在自动化方面。HomeTests.testHomepageLoads(HomeTests.groovy:14)
我的项目未通过测试如何进行纠正?
命令历史记录为:getTitle()setContext(a87ff87c1ae249be99c6363519627de8)windowMaximize()setContext(HomeTests:test主页加载)打开(http://www.facebook.com/login.php,true)
PATH变量中有firefox吗?Selenium需要从安装目录启动firefox实例,并需要知道该目录在哪里
我也面临同样的问题。我觉得你的设置不错。试试这个命令:test-app :selenium