From 95343f469a0af232f7d274085628f4ad1571533f Mon Sep 17 00:00:00 2001 From: Adam Goucher Date: Tue, 10 Apr 2012 14:07:22 -0400 Subject: [PATCH 001/141] properly handling the situation where you dont pass in a browser string. seems '' is something, not null --- PHPWebDriver/WebDriver.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PHPWebDriver/WebDriver.php b/PHPWebDriver/WebDriver.php index 755c2c554..380ed8d9a 100644 --- a/PHPWebDriver/WebDriver.php +++ b/PHPWebDriver/WebDriver.php @@ -18,8 +18,13 @@ class PHPWebDriver_WebDriver extends PHPWebDriver_WebDriverBase { - function __construct($executor = "") { - parent::__construct($executor); + function __construct($executor = null) { + if (! is_null($executor)) { + parent::__construct($executor); + } else { + parent::__construct(); + } + } protected function methods() { From bfceac93e3dbdbe31511fec6991bf15a9c8102ff Mon Sep 17 00:00:00 2001 From: Adam Goucher Date: Tue, 10 Apr 2012 14:09:41 -0400 Subject: [PATCH 002/141] elements will now also have the originating session as a property --- PHPWebDriver/WebDriverContainer.php | 17 ++++++++++++----- PHPWebDriver/WebDriverElement.php | 3 ++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/PHPWebDriver/WebDriverContainer.php b/PHPWebDriver/WebDriverContainer.php index 46166468e..b8e55e54a 100644 --- a/PHPWebDriver/WebDriverContainer.php +++ b/PHPWebDriver/WebDriverContainer.php @@ -50,11 +50,18 @@ public function elements($using, $value) { } protected function webDriverElement($value) { - return array_key_exists('ELEMENT', (array) $value) ? - new PHPWebDriver_WebDriverElement( - $this->getElementPath($value['ELEMENT']), // url - $value['ELEMENT']) : // id - null; + + if (array_key_exists('ELEMENT', (array) $value)) { + if (get_class($this) == "PHPWebDriver_WebDriverSession") { + return new PHPWebDriver_WebDriverElement( + $this->getElementPath($value['ELEMENT']), // url + $value['ELEMENT'], // id + $this // session + ); + + } + } + return null; } abstract protected function getElementPath($element_id); diff --git a/PHPWebDriver/WebDriverElement.php b/PHPWebDriver/WebDriverElement.php index 42b8810e0..19965949a 100644 --- a/PHPWebDriver/WebDriverElement.php +++ b/PHPWebDriver/WebDriverElement.php @@ -36,9 +36,10 @@ protected function methods() { } private $id; - public function __construct($url, $id) { + public function __construct($url, $id, $session) { $this->id = $id; parent::__construct($url); + $this->session = $session; } public function getID() { From 29a3e94f57111dc00e52011b8d5527500c8bc96c Mon Sep 17 00:00:00 2001 From: Adam Goucher Date: Tue, 10 Apr 2012 14:10:23 -0400 Subject: [PATCH 003/141] html5 media elements (video and audio) --- PHPWebDriver/Support/HTML5/Audio.php | 26 ++++++ PHPWebDriver/Support/HTML5/Media.php | 120 +++++++++++++++++++++++++++ PHPWebDriver/Support/HTML5/Video.php | 79 ++++++++++++++++++ PHPWebDriver/WebDriverExceptions.php | 3 +- test/VideoTest.php | 101 ++++++++++++++++++++++ 5 files changed, 328 insertions(+), 1 deletion(-) create mode 100644 PHPWebDriver/Support/HTML5/Audio.php create mode 100644 PHPWebDriver/Support/HTML5/Media.php create mode 100644 PHPWebDriver/Support/HTML5/Video.php create mode 100644 test/VideoTest.php diff --git a/PHPWebDriver/Support/HTML5/Audio.php b/PHPWebDriver/Support/HTML5/Audio.php new file mode 100644 index 000000000..ca2ea68ce --- /dev/null +++ b/PHPWebDriver/Support/HTML5/Audio.php @@ -0,0 +1,26 @@ +element("tag_name", "audio")); + * $a->play(); + */ + public function __construct($webelement) { + if (strtolower($webelement->name()) != "audio") { + throw new PHPWebDriver_UnexpectedTagNameException(sprintf( + 'Audio only works on