我有php 5.6.14。
/** @When /^I want to see JS alert$/ */
public function iExecuteJs() {
$this->webDriver()->executeScript("jsAlert()");
if ($this->webDriver()->switchTo()->alert()->getText().contains("js")){
echo "test passed";
};
}
我该怎么办?
由于
答案 0 :(得分:0)
最后,我更改了代码:
$element = $this->webDriver()->switchTo()->alert()->getText();
if ($element == "I am a JS Alert"){
echo "correct js alert appeared";
}