1: <?php
2: namespace Azalea\Selenium\Core;
3:
4: class Page extends WebDriver
5: {
6: 7: 8: 9: 10:
11: public static function get($driver)
12: {
13: if (!$driver) {
14: throw new \InvalidArgumentException(get_class($this).": driver not defined");
15: }
16:
17: if (!empty(static::$url) && !is_null(static::$url)) {
18: $driver->url(static::$url);
19: }
20:
21: $classname = get_called_class();
22: return new $classname($driver);
23: }
24:
25: 26: 27: 28: 29: 30: 31:
32: public function checkTitle($title)
33: {
34: if ($this->title() !== $title) {
35: throw new \RuntimeException(get_class($this).": Unexpected page title, expected '".$title."' but found '".$this->title()."'");
36: }
37: return true;
38: }
39:
40: 41: 42: 43: 44:
45: public function title()
46: {
47: if ($this->driver) {
48: return $this->driver->title();
49: }
50: throw new \RuntimeException(get_class($this).": driver not found");
51: }
52:
53: 54: 55: 56:
57: protected function verify()
58: {
59: return true;
60: }
61: }
62: ?>