/** * @return string * @throws WebDriverException */ public function getPageSource() { try { return $this->driver->getPageSource(); } catch (WebDriverException $exception) { $this->dispatchOnException($exception); } }
public function isTextPresent($text) { $found = false; $i = 0; do { $html = $this->webdriver->getPageSource(); if (is_string($html)) { $found = !(strpos($html, $text) === false); } if (!$found) { sleep(self::STEP_WAITING_TIME); $i += self::STEP_WAITING_TIME; } } while (!$found && $i <= self::MAX_WAITING_TIME); return $found; }
/** * @Then /I should see the text "(.+)"$/ */ function i_should_see_the_text($text) { $this->init_webdriver(); $source = $this->webdriver->getPageSource(); $this->assert_true(strpos($source, $text) !== false, '{step}'); }