使用selenium方法'isTextPresent'的错误消息

时间:2013-06-10 04:47:48

标签: java selenium

我正在尝试使用Selenium(2.32)方法“isTextPresent”在某些网站上搜索字符串。 为了有效地执行它,我需要按照regexpi的建议搜索不区分大小写,但是我得到如下错误(HTML包含字符串“你说的是什么”):

声明:

private Selenium selenium;
driver = new FirefoxDriver();
String baseUrl = "http://openurl.ebscohost.com";
selenium = new WebDriverBackedSelenium(driver, baseUrl);

选项1(“大写的'SAY'):

if(selenium.isTextPresent("WHAT YOU SAY")) {
    return ("PASS");
}
else{ return "FAIL";}

输出:“通过”

选项2(“具有小写字母的'SAy'”):

if(selenium.isTextPresent("WHAT YOU SAy")) {
    return ("PASS");
}
else{ return "FAIL";}

输出:“失败”

选项3(“'小写字母'但带有正则表达式'的'SAy'):

if(selenium.isTextPresent("regexp:WHAT YOU SAy")) {
    return ("PASS");
}
else{ return "FAIL";}

输出:“失败”

选项4(“说'带小写字母,但带有regexpi”):

if(selenium.isTextPresent("regexpi:WHAT YOU SAy")) {
    return ("PASS");
}
else{ return "FAIL";}

输出:ERROR

错误:

> ERROR:com.thoughtworks.selenium.SeleniumException: TypeError: RegExp(...).text is not a function
Command duration or timeout: 1.97 seconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_32'
Session ID: 195d399d-c745-42c5-be6d-7d47811c9c26
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=20.0.1, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]

我错过了什么吗?

谢谢我提前!

0 个答案:

没有答案