This repository was archived by the owner on Mar 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ class HttpCommandExecutor implements WebDriverCommandExecutor
146
146
DriverCommand::DISMISS_ALERT => ['method ' => 'POST ' , 'url ' => '/session/:sessionId/alert/dismiss ' ],
147
147
DriverCommand::EXECUTE_ASYNC_SCRIPT => ['method ' => 'POST ' , 'url ' => '/session/:sessionId/execute/async ' ],
148
148
DriverCommand::EXECUTE_SCRIPT => ['method ' => 'POST ' , 'url ' => '/session/:sessionId/execute/sync ' ],
149
+ DriverCommand::GET_ACTIVE_ELEMENT => ['method ' => 'GET ' , 'url ' => '/session/:sessionId/element/active ' ],
149
150
DriverCommand::GET_ALERT_TEXT => ['method ' => 'GET ' , 'url ' => '/session/:sessionId/alert/text ' ],
150
151
DriverCommand::GET_CURRENT_WINDOW_HANDLE => ['method ' => 'GET ' , 'url ' => '/session/:sessionId/window ' ],
151
152
DriverCommand::GET_ELEMENT_LOCATION => ['method ' => 'GET ' , 'url ' => '/session/:sessionId/element/:id/rect ' ],
Original file line number Diff line number Diff line change 15
15
16
16
namespace Facebook \WebDriver ;
17
17
18
+ use Facebook \WebDriver \Remote \RemoteWebElement ;
19
+
18
20
/**
19
21
* @covers \Facebook\WebDriver\Remote\RemoteTargetLocator
20
22
*/
@@ -52,4 +54,21 @@ public function testShouldSwitchToWindow()
52
54
$ this ->assertContains ('index.html ' , $ this ->driver ->getCurrentURL ());
53
55
$ this ->assertNotSame ($ originalWindowHandle , $ this ->driver ->getWindowHandle ());
54
56
}
57
+
58
+ /**
59
+ * @cover ::activeElement
60
+ */
61
+ public function testActiveElement ()
62
+ {
63
+ $ this ->driver ->get ($ this ->getTestPageUrl ('index.html ' ));
64
+
65
+ $ activeElement = $ this ->driver ->switchTo ()->activeElement ();
66
+ $ this ->assertInstanceOf (RemoteWebElement::class, $ activeElement );
67
+ $ this ->assertSame ('body ' , $ activeElement ->getTagName ());
68
+
69
+ $ this ->driver ->findElement (WebDriverBy::name ('test_name ' ))->click ();
70
+ $ activeElement = $ this ->driver ->switchTo ()->activeElement ();
71
+ $ this ->assertSame ('input ' , $ activeElement ->getTagName ());
72
+ $ this ->assertSame ('test_name ' , $ activeElement ->getAttribute ('name ' ));
73
+ }
55
74
}
You can’t perform that action at this time.
0 commit comments