Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 39a4f39

Browse files
committed
Licensing and WebDriverEventListener is an interface.
Also simple phpdoc changes for exceptions
1 parent f64a068 commit 39a4f39

File tree

5 files changed

+76
-41
lines changed

5 files changed

+76
-41
lines changed

lib/EventFiringWebDriverNavigation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getNavigator() {
5454

5555
/**
5656
* @return $this
57-
* @throws Exception|WebDriverException
57+
* @throws WebDriverException
5858
*/
5959
public function back() {
6060

@@ -74,7 +74,7 @@ public function back() {
7474

7575
/**
7676
* @return $this
77-
* @throws Exception|WebDriverException
77+
* @throws WebDriverException
7878
*/
7979
public function forward() {
8080

@@ -94,7 +94,7 @@ public function forward() {
9494

9595
/**
9696
* @return $this
97-
* @throws Exception|WebDriverException
97+
* @throws WebDriverException
9898
*/
9999
public function refresh() {
100100
try {
@@ -111,7 +111,7 @@ public function refresh() {
111111
/**
112112
* @param $url
113113
* @return $this
114-
* @throws Exception|WebDriverException
114+
* @throws WebDriverException
115115
*/
116116
public function to($url) {
117117

lib/EventFiringWebElement.php

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
<?php
2+
// Copyright 2004-present Facebook. All Rights Reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
215

316
class EventFiringWebElement {
417

@@ -63,7 +76,7 @@ private function newElement(WebDriverElement $element) {
6376
/**
6477
* @param $value
6578
* @return $this
66-
* @throws Exception|WebDriverException
79+
* @throws WebDriverException
6780
*/
6881
public function sendKeys($value) {
6982

@@ -83,7 +96,7 @@ public function sendKeys($value) {
8396

8497
/**
8598
* @return $this
86-
* @throws Exception|WebDriverException
99+
* @throws WebDriverException
87100
*/
88101
public function click() {
89102

@@ -104,7 +117,7 @@ public function click() {
104117
/**
105118
* @param WebDriverBy $by
106119
* @return EventFiringWebElement
107-
* @throws Exception|WebDriverException
120+
* @throws WebDriverException
108121
*/
109122
public function findElement(WebDriverBy $by) {
110123

@@ -125,7 +138,7 @@ public function findElement(WebDriverBy $by) {
125138
/**
126139
* @param WebDriverBy $by
127140
* @return array
128-
* @throws Exception|WebDriverException
141+
* @throws WebDriverException
129142
*/
130143
public function findElements(WebDriverBy $by) {
131144

@@ -151,7 +164,7 @@ public function findElements(WebDriverBy $by) {
151164

152165
/**
153166
* @return $this
154-
* @throws Exception|WebDriverException
167+
* @throws WebDriverException
155168
*/
156169
public function clear() {
157170
try {
@@ -168,7 +181,7 @@ public function clear() {
168181
/**
169182
* @param $attribute_name
170183
* @return string
171-
* @throws Exception|WebDriverException
184+
* @throws WebDriverException
172185
*/
173186
public function getAttribute($attribute_name) {
174187
try {
@@ -184,7 +197,7 @@ public function getAttribute($attribute_name) {
184197
/**
185198
* @param $css_property_name
186199
* @return string
187-
* @throws Exception|WebDriverException
200+
* @throws WebDriverException
188201
*/
189202
public function getCSSValue($css_property_name) {
190203
try {
@@ -199,7 +212,7 @@ public function getCSSValue($css_property_name) {
199212

200213
/**
201214
* @return WebDriverLocation
202-
* @throws Exception|WebDriverException
215+
* @throws WebDriverException
203216
*/
204217
public function getLocation() {
205218
try {
@@ -229,7 +242,7 @@ public function getLocationOnScreenOnceScrolledIntoView() {
229242

230243
/**
231244
* @return WebDriverDimension
232-
* @throws Exception|WebDriverException
245+
* @throws WebDriverException
233246
*/
234247
public function getSize() {
235248
try {
@@ -244,7 +257,7 @@ public function getSize() {
244257

245258
/**
246259
* @return string
247-
* @throws Exception|WebDriverException
260+
* @throws WebDriverException
248261
*/
249262
public function getTagName() {
250263
try {
@@ -259,7 +272,7 @@ public function getTagName() {
259272

260273
/**
261274
* @return string
262-
* @throws Exception|WebDriverException
275+
* @throws WebDriverException
263276
*/
264277
public function getText() {
265278
try {
@@ -274,7 +287,7 @@ public function getText() {
274287

275288
/**
276289
* @return bool
277-
* @throws Exception|WebDriverException
290+
* @throws WebDriverException
278291
*/
279292
public function isDisplayed() {
280293
try {
@@ -289,7 +302,7 @@ public function isDisplayed() {
289302

290303
/**
291304
* @return bool
292-
* @throws Exception|WebDriverException
305+
* @throws WebDriverException
293306
*/
294307
public function isEnabled() {
295308
try {
@@ -304,7 +317,7 @@ public function isEnabled() {
304317

305318
/**
306319
* @return bool
307-
* @throws Exception|WebDriverException
320+
* @throws WebDriverException
308321
*/
309322
public function isSelected() {
310323
try {
@@ -319,7 +332,7 @@ public function isSelected() {
319332

320333
/**
321334
* @return $this
322-
* @throws Exception|WebDriverException
335+
* @throws WebDriverException
323336
*/
324337
public function submit() {
325338
try {
@@ -335,7 +348,7 @@ public function submit() {
335348

336349
/**
337350
* @return string
338-
* @throws Exception|WebDriverException
351+
* @throws WebDriverException
339352
*/
340353
public function getID() {
341354
try {

lib/WebDriver.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ public function __construct(
3535
);
3636
}
3737

38-
public function getExecutor() {
39-
return $this->executor;
40-
}
41-
4238
/**
4339
* Close the current window.
4440
*

lib/WebDriverDispatcher.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
<?php
2+
// Copyright 2004-present Facebook. All Rights Reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
215

316
class WebDriverDispatcher {
417

lib/WebDriverEventListener.php

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,102 @@
11
<?php
2-
3-
abstract class WebDriverEventListener {
2+
// Copyright 2004-present Facebook. All Rights Reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
interface WebDriverEventListener {
417

518
/**
619
* @param string $url
720
* @param EventFiringWebDriver $driver
821
*/
9-
public function beforeNavigateTo($url, EventFiringWebDriver $driver) { }
22+
public function beforeNavigateTo($url, EventFiringWebDriver $driver);
1023

1124
/**
1225
* @param string $url
1326
* @param EventFiringWebDriver $driver
1427
*/
15-
public function afterNavigateTo($url, EventFiringWebDriver $driver) { }
28+
public function afterNavigateTo($url, EventFiringWebDriver $driver);
1629

1730
/**
1831
* @param EventFiringWebDriver $driver
1932
*/
20-
public function beforeNavigateBack(EventFiringWebDriver $driver) { }
33+
public function beforeNavigateBack(EventFiringWebDriver $driver);
2134

2235
/**
2336
* @param EventFiringWebDriver $driver
2437
*/
25-
public function afterNavigateBack(EventFiringWebDriver $driver) { }
38+
public function afterNavigateBack(EventFiringWebDriver $driver);
2639

2740
/**
2841
* @param EventFiringWebDriver $driver
2942
*/
30-
public function beforeNavigateForward(EventFiringWebDriver $driver) { }
43+
public function beforeNavigateForward(EventFiringWebDriver $driver);
3144

3245
/**
3346
* @param EventFiringWebDriver $driver
3447
*/
35-
public function afterNavigateForward(EventFiringWebDriver $driver) { }
48+
public function afterNavigateForward(EventFiringWebDriver $driver);
3649

3750
/**
3851
* @param WebDriverBy $by
3952
* @param EventFiringWebElement|null $element
4053
* @param EventFiringWebDriver $driver
4154
*/
42-
public function beforeFindBy(WebDriverBy $by, $element, EventFiringWebDriver $driver) { }
55+
public function beforeFindBy(WebDriverBy $by, $element, EventFiringWebDriver $driver);
4356

4457
/**
4558
* @param WebDriverBy $by
4659
* @param EventFiringWebElement|null $element
4760
* @param EventFiringWebDriver $driver
4861
*/
49-
public function afterFindBy(WebDriverBy $by, $element, EventFiringWebDriver $driver) { }
62+
public function afterFindBy(WebDriverBy $by, $element, EventFiringWebDriver $driver);
5063

5164
/**
5265
* @param string $script
5366
* @param EventFiringWebDriver $driver
5467
*/
55-
public function beforeScript($script, EventFiringWebDriver $driver) { }
68+
public function beforeScript($script, EventFiringWebDriver $driver);
5669

5770
/**
5871
* @param string $script
5972
* @param EventFiringWebDriver $driver
6073
*/
61-
public function afterScript($script, EventFiringWebDriver $driver) { }
74+
public function afterScript($script, EventFiringWebDriver $driver);
6275

6376
/**
6477
* @param EventFiringWebElement $element
6578
*/
66-
public function beforeClickOn(EventFiringWebElement $element) { }
79+
public function beforeClickOn(EventFiringWebElement $element);
6780

6881
/**
6982
* @param EventFiringWebElement $element
7083
*/
71-
public function afterClickOn(EventFiringWebElement $element) { }
84+
public function afterClickOn(EventFiringWebElement $element);
7285

7386
/**
7487
* @param EventFiringWebElement $element
7588
*/
76-
public function beforeChangeValueOf(EventFiringWebElement $element) { }
89+
public function beforeChangeValueOf(EventFiringWebElement $element);
7790

7891
/**
7992
* @param EventFiringWebElement $element
8093
*/
81-
public function afterChangeValueOf(EventFiringWebElement $element) { }
94+
public function afterChangeValueOf(EventFiringWebElement $element);
8295

8396
/**
8497
* @param WebDriverException $exception
8598
* @param EventFiringWebDriver $driver
8699
*/
87-
public function onException(WebDriverException $exception, EventFiringWebDriver $driver = null) { }
100+
public function onException(WebDriverException $exception, EventFiringWebDriver $driver = null);
88101

89102
}

0 commit comments

Comments
 (0)