Php selenium IDE生成的模式总是错误的?

Php selenium IDE生成的模式总是错误的?,php,regex,selenium,phpunit,preg-match,Php,Regex,Selenium,Phpunit,Preg Match,我正在用php编写selenium测试用例,方法是从selenium IDE导出它。每当我在IDE中使用verifyText时,它都会在php中生成preg_match断言,get在所有不同的情况下都会失败。这是其中之一, try { $this->assertTrue((bool)preg_match('/^exact:Wachtwoord vergeten[\s\S]$/',$this->getText("link=exact:Wachtwoord vergeten?")

我正在用php编写selenium测试用例,方法是从selenium IDE导出它。每当我在IDE中使用verifyText时,它都会在php中生成
preg_match
断言,get在所有不同的情况下都会失败。这是其中之一,

try {
    $this->assertTrue((bool)preg_match('/^exact:Wachtwoord vergeten[\s\S]$/',$this->getText("link=exact:Wachtwoord vergeten?")));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
        array_push($this->selenium->verificationErrors, $e->toString());
}
脚本是从selenium IDE自动生成的。我不知道我做错了什么,或者我可以在IDE中做任何更改来纠正这个错误吗?因为它是从IDE自动生成的,所以我不想修改代码来修复它


任何帮助或建议都将不胜感激。

我的猜测是getText结果与您所寻找的不匹配。您可以尝试将搜索字符串(^exact:Wachtwoord vergeten[\s\s]$)与getText()的结果进行比较。这种情况经常发生在我身上,解决方法就是从我的搜索字符串中删除'exact:'字符串。 就你而言:

try {
    $this->assertTrue((bool)preg_match('/^Wachtwoord vergeten[\s\S]$/',$this->getText("link=exact:Wachtwoord vergeten?")));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
        array_push($this->selenium->verificationErrors, $e->toString());
}

你说的
get在所有不同的情况下都会失败是什么意思?
?我的意思是每次脚本(自动生成)中有preg_匹配时它都会失败。我知道我们与string匹配的模式是错误的。但是这段代码是从selenium IDE自动生成的,不是每次都在代码中更正,我想知道是否有任何方法可以从selenium IDE获得正确的模式