Skip to content

Commit 6a01772

Browse files
committed
Merge pull request Element-34#26 from bernardpeh/master
Allowed switch_to_frame() to switch back to parent html
2 parents b50b02d + 6b9f03d commit 6a01772

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

PHPWebDriver/WebDriverSession.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ public function touch() {
196196
public function switch_to_frame($frame = null, $curl_opts = array()) {
197197
if (is_a($frame, "PHPWebDriver_WebDriverElement")) {
198198
$frame_id = array("id" => array("ELEMENT" => $frame->getId()));
199+
} elseif ($frame == null) {
200+
$frame_id = null;
199201
} else {
200202
throw new InvalidArgumentException('$frame needs to be a webdriver element of a frame');
201203
}
@@ -243,4 +245,4 @@ protected function getElementPath($element_id) {
243245
return sprintf('%s/element/%s', $this->url, $element_id);
244246
}
245247
}
246-
?>
248+
?>

test/FrameTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public function test_frame_stuff() {
2626
$ps = self::$session->elements("css selector", "p");
2727
$this->assertEquals(count($ps), 6);
2828
// switch back
29-
self::$session->frame();
29+
self::$session->switch_to_frame();
3030
}
3131
}

0 commit comments

Comments
 (0)