public function checkFooterLoads() { global $lookFor; $lookFor = "<!-- EndOfPage --></body>\n</html>"; $this->webDriver->wait(30, 300)->until(function ($webDriver) { global $lookFor; return strpos($webDriver->getPageSource(), $lookFor) !== null; }); $this->assertNotNull(strpos($this->webDriver->getPageSource(), $lookFor)); }
public function grabTextFrom($cssOrXPathOrRegex) { $els = $this->match($this->webDriver, $cssOrXPathOrRegex); if (count($els)) { return $els[0]->getText(); } if (@preg_match($cssOrXPathOrRegex, $this->webDriver->getPageSource(), $matches)) { return $matches[1]; } throw new ElementNotFound($cssOrXPathOrRegex, 'CSS or XPath or Regex'); }
/** * Возвращаем параметры для текущей вариации (текущего состояния страницы) * @param string $model_name * @return array */ public function get_variation_param($model_name, $options_size_text) { // $variation = array(); $str = $this->web_driver->getPageSource(); $html = str_get_html($str); $img_url = trim($html->find('#MainContent_img_big', 0)->src); $color_code = trim($html->find('#MainContent_DDListColors option[selected]', 0)->value); $color_letter = trim($html->find('#MainContent_DDListColors option[selected]', 0)->innertext); if (count($html->find('#MainContent_lbl_frameColor'))) { $color_frame = $html->find('#MainContent_lbl_frameColor'); $color_frame = $color_frame[0]->innertext; } else { $color_frame = $color_letter; } // $color_frame = trim($html->find('#MainContent_lbl_frameColor', 0)->innertext); // $size = trim($html->find('#MainContent_DDListSize option', 0)->innertext); $size = $options_size_text; $sizes = explode("-", $size); $name = $model_name . ' ' . $color_letter; $name = str_replace(' ', '_', trim($name)); return array('code' => $name, 'color_letter' => $color_letter, 'img_url' => $img_url, 'color_code' => $color_code, 'color_frame' => $color_frame, 'size_1' => $sizes[0], 'size_2' => $sizes[1], 'size_3' => $sizes[2]); // return $variation; }
/** * Return true if the actual page contains $text * @param string $text The text to search for */ public function assertPageContainsText($text) { $this->assertContains($text, self::$webDriver->getPageSource()); }
protected function assertPageNotContains($needle, $message = '') { $this->assertThatItsNot($this->webDriver->getPageSource(), new PageConstraint($needle, $this->_getCurrentUri()), $message); }