xpath assertion failure with dynamic xpath
问题 This is very similar to: adding php variable into Xpath But slightly different... What I'm trying to do is this: $status = "Test!"; //ajax request to update the page $this->postToPage($status); //This is the part that is failing.. $this->waitUntil(function () { if ($this->byXPath("//span[contains(text(),'{$status}')]")) { return true; } return null; }, 20000); $elementtext = $this->byXpath("//span[contains(text(),'{$status}')]")->text(); $this->assertEquals($status, $elementtext); Failed