Skip to content

Commit b1b4d1e

Browse files
author
LuisRBarreras
committed
Magic methods' comments
1 parent f7b3be9 commit b1b4d1e

File tree

6 files changed

+71
-32
lines changed

6 files changed

+71
-32
lines changed

src/Nearsoft/SeleniumClient/By.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,29 @@ public function getSelectorValue() { return $this->_selectorValue; }
2727
/**
2828
* Locate by element's css class name
2929
* @param String $selectorValue
30-
* @return \SeleniumClient\By
30+
* @return Nearsoft\SeleniumClient\By
3131
*/
3232
public static function className($selectorValue) { return new By("class name", $selectorValue); }
3333

3434
/**
3535
* Locate by element's css selector path
3636
* @param String $selectorValue
37-
* @return \SeleniumClient\By
37+
* @return Nearsoft\SeleniumClient\By
3838
*/
3939
public static function cssSelector($selectorValue) { return new By("css selector", $selectorValue); }
4040

4141
/**
4242
* Locate by element's id
4343
* @param String $selectorValue
44-
* @return \SeleniumClient\By
44+
* @return Nearsoft\SeleniumClient\By
4545
*/
4646
public static function id($selectorValue) { return new By("id", $selectorValue); }
4747

4848
/**
4949
* Locate by JavaScript selector
5050
* @param string $selectorValue
5151
* @param string $selectorDefinition
52-
* @return \SeleniumClient\By
52+
* @return Nearsoft\SeleniumClient\By
5353
*/
5454
public static function jsSelector($selectorValue, $selectorDefinition = '$')
5555
{
@@ -59,35 +59,35 @@ public static function jsSelector($selectorValue, $selectorDefinition = '$')
5959
/**
6060
* Locate by element's name
6161
* @param String $selectorValue
62-
* @return \SeleniumClient\By
62+
* @return Nearsoft\SeleniumClient\By
6363
*/
6464
public static function name($selectorValue) { return new By("name", $selectorValue); }
6565

6666
/**
6767
* Locate by element's link text
6868
* @param String $selectorValue
69-
* @return \SeleniumClient\By
69+
* @return Nearsoft\SeleniumClient\By
7070
*/
7171
public static function linkText($selectorValue) { return new By("link text", $selectorValue); }
7272

7373
/**
7474
* Locate by part of element's link text
7575
* @param String $selectorValue
76-
* @return \SeleniumClient\By
76+
* @return Nearsoft\SeleniumClient\By
7777
*/
7878
public static function partialLinkText($selectorValue) { return new By("partial link text", $selectorValue); }
7979

8080
/**
8181
* Locate by element's tag name
8282
* @param String $selectorValue
83-
* @return \SeleniumClient\By
83+
* @return Nearsoft\SeleniumClient\By
8484
*/
8585
public static function tagName($selectorValue) { return new By("tag name", $selectorValue); }
8686

8787
/**
8888
* Locate by element's xPath
8989
* @param String $selectorValue
90-
* @return \SeleniumClient\By
90+
* @return Nearsoft\SeleniumClient\By
9191
*/
9292
public static function xPath($selectorValue) { return new By("xpath", $selectorValue); }
9393

src/Nearsoft/SeleniumClient/Options.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(WebDriver $driver)
2828

2929
/**
3030
* Gets Timeouts object
31-
* @return SeleniumClient\Timeouts
31+
* @return Nearsoft\SeleniumClient\Timeouts
3232
*/
3333
public function timeouts()
3434
{
@@ -41,7 +41,7 @@ public function timeouts()
4141

4242
/**
4343
* Gets Window object
44-
* @return SeleniumClient\Window
44+
* @return Nearsoft\SeleniumClient\Window
4545
*/
4646
public function window()
4747
{
@@ -97,7 +97,7 @@ public function getCookieNamed($cookieName)
9797

9898
/**
9999
* Remove a cookie
100-
* @param SeleniumClient\Cookie $cookie
100+
* @param Nearsoft\SeleniumClient\Cookie $cookie
101101
*/
102102
public function deleteCookie(Cookie $cookie)
103103
{

src/Nearsoft/SeleniumClient/TargetLocator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(WebDriver $driver)
2727
/**
2828
* Change to the Window by passing in the name
2929
* @param String $identifier either window name or window handle
30-
* @return \SeleniumClient\WebDriver The current webdriver
30+
* @return Nearsoft\SeleniumClient\WebDriver The current webdriver
3131
*/
3232
public function window($identifier)
3333
{
@@ -40,7 +40,7 @@ public function window($identifier)
4040
/**
4141
* Focus on specified frame
4242
* @param Mixed $identifier. Null will get default frame. String will get by frame name. Integer will get frame by index. WebElement will get by web element relation.
43-
* @return \SeleniumClient\WebDriver The current webdriver
43+
* @return Nearsoft\SeleniumClient\WebDriver The current webdriver
4444
*/
4545
public function frame($identifier)
4646
{
@@ -72,7 +72,7 @@ public function activeElement()
7272

7373
/**
7474
* Switches to the currently active modal dialog for this particular driver instance.
75-
* @return \SeleniumClient\Alert
75+
* @return Nearsoft\SeleniumClient\Alert
7676
*/
7777
public function alert()
7878
{

src/Nearsoft/SeleniumClient/WebDriver.php

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,45 @@
2020
use Nearsoft\SeleniumClient\Http\HttpClient;
2121
use Nearsoft\SeleniumClient\Http\HttpFactory;
2222

23+
24+
/**
25+
* Class WebDriver
26+
* @package Nearsoft\SeleniumClient
27+
*
28+
* @method Nearsoft\SeleniumClient\Navigation navigationBack()
29+
* @method Nearsoft\SeleniumClient\Navigation navigationForward()
30+
* @method Nearsoft\SeleniumClient\Navigation navigationRefresh()
31+
* @method Nearsoft\SeleniumClient\Navigation navigationTo($url)
32+
*
33+
* @method Nearsoft\SeleniumClient\Window windowMaximize()
34+
* @method Nearsoft\SeleniumClient\Window windowGetSize()
35+
* @method Nearsoft\SeleniumClient\Window windowGetPosition()
36+
* @method Nearsoft\SeleniumClient\Window windowSetSize($width, $height)
37+
* @method Nearsoft\SeleniumClient\Window windowSetPosition($x, $y)
38+
*
39+
* @method Nearsoft\SeleniumClient\TargetLocator switchToWindow($identifier)
40+
* @method Nearsoft\SeleniumClient\TargetLocator switchToFrame($identifier)
41+
*
42+
* @method Nearsoft\SeleniumClient\WebElement findElementByCssSelector($selectorValue)
43+
* @method Nearsoft\SeleniumClient\WebElement findElementById($selectorValue)
44+
* @method Nearsoft\SeleniumClient\WebElement findElementByJsSelector($selectorValue, $selectorDefinition='$')
45+
* @method Nearsoft\SeleniumClient\WebElement findElementByLinkText($selectorValue)
46+
* @method Nearsoft\SeleniumClient\WebElement findElementByName($selectorValue)
47+
* @method Nearsoft\SeleniumClient\WebElement findElementByPartialLinkText($selectorValue)
48+
* @method Nearsoft\SeleniumClient\WebElement findElementByTagName($selectorValue)
49+
* @method Nearsoft\SeleniumClient\WebElement findElementByXPath($selectorValue)
50+
*
51+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsByCssSelector($selectorValue)
52+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsById($selectorValue)
53+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsByJsSelector($selectorValue, $selectorDefinition='$')
54+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsByLinkText($selectorValue)
55+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsByName($selectorValue)
56+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsByPartialLinkText($selectorValue)
57+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsByTagName($selectorValue)
58+
* @method Nearsoft\SeleniumClient\WebElement[] findElementsByXPath($selectorValue)
59+
*/
60+
61+
2362
class WebDriver
2463
{
2564
private $_hubUrl = null;
@@ -172,7 +211,7 @@ private function callFindElement($name, array $args)
172211
switch ( $call ) {
173212
case 'findElement':
174213
case 'findElements':
175-
if ( method_exists( '\\SeleniumClient\\By', $by ) ) {
214+
if ( method_exists( 'Nearsoft\\SeleniumClient\\By', $by ) ) {
176215
$valid = true;
177216
}
178217
}
@@ -181,7 +220,7 @@ private function callFindElement($name, array $args)
181220
throw new \Exception( 'Invalid magic call: '.$name );
182221
}
183222

184-
$method = new \ReflectionMethod( '\\SeleniumClient\\By', $by );
223+
$method = new \ReflectionMethod( 'Nearsoft\\SeleniumClient\\By', $by );
185224
$byArgs = array_splice( $args, 0, $method->getNumberOfParameters() );
186225
array_unshift( $args, $method->invokeArgs( null, $byArgs ) );
187226
$element = call_user_func_array( array( $this, $call ), $args );
@@ -254,7 +293,7 @@ public function getHubUrl() { return $this->_hubUrl; }
254293

255294
/**
256295
* Get Navigation object
257-
* @return Selenium\Navigation
296+
* @return Nearsoft\Selenium\Navigation
258297
*/
259298
public function navigate()
260299
{
@@ -288,7 +327,7 @@ public function getScreenShotsDirectory() { return $this->_screenshotsDirectory;
288327

289328
/**
290329
* Gets Options object
291-
* @return SeleniumClient\Options
330+
* @return Nearsoft\SeleniumClient\Options
292331
*/
293332
public function manage()
294333
{
@@ -298,7 +337,7 @@ public function manage()
298337

299338
/**
300339
* Creates new target locator to be handled
301-
* @return \SeleniumClient\TargetLocator
340+
* @return Nearsoft\SeleniumClient\TargetLocator
302341
*/
303342
public function switchTo()
304343
{
@@ -463,7 +502,7 @@ public function screenshot($overrideScreenshotsDirectory = null)
463502
* @param bool $polling
464503
* @param int $elementId
465504
* @throws Http\SeleniumNoSuchElementException
466-
* @return \SeleniumClient\WebElement
505+
* @return Nearsoft\SeleniumClient\WebElement
467506
*/
468507
public function findElement(By $locator, $polling = false, $elementId = -1)
469508
{
@@ -494,7 +533,7 @@ public function findElement(By $locator, $polling = false, $elementId = -1)
494533
* @param bool $polling
495534
* @param int $elementId
496535
* @throws Exceptions\InvalidSelector
497-
* @return \SeleniumClient\WebElement[]
536+
* @return Nearsoft\SeleniumClient\WebElement[]
498537
*/
499538
public function findElements(By $locator, $polling = false, $elementId = -1)
500539
{
@@ -557,7 +596,7 @@ public function findElements(By $locator, $polling = false, $elementId = -1)
557596
* Stops the process until an element is found
558597
* @param By $locator
559598
* @param Integer $timeOutSeconds
560-
* @return \SeleniumClient\WebElement
599+
* @return Nearsoft\SeleniumClient\WebElement
561600
*/
562601
public function waitForElementUntilIsPresent(By $locator, $timeOutSeconds = 5)
563602
{

src/Nearsoft/SeleniumClient/WebDriverWait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function getSeconds()
3737
* @param String $method
3838
* @param Array $args
3939
* @throws \Exception
40-
* @throws SeleniumClient\Exceptions\WebDriverWaitTimeout
40+
* @throws Nearsoft\SeleniumClient\Exceptions\WebDriverWaitTimeout
4141
* @return mixed
4242
*/
4343
public function until($seleniumObject, $method, array $args)

src/Nearsoft/SeleniumClient/WebElement.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public function getLocationOnScreenOnceScrolledIntoView()
307307
* Find element within current element
308308
* @param By $locator
309309
* @param Boolean $polling
310-
* @return \SeleniumClient\WebElement
310+
* @return Nearsoft\SeleniumClient\WebElement
311311
*/
312312
public function findElement(By $locator, $polling = false)
313313
{
@@ -318,7 +318,7 @@ public function findElement(By $locator, $polling = false)
318318
* Find elements within current element
319319
* @param By $locator
320320
* @param Boolean $polling
321-
* @return \SeleniumClient\WebElement[]
321+
* @return Nearsoft\SeleniumClient\WebElement[]
322322
*/
323323
public function findElements(By $locator, $polling = false)
324324
{
@@ -341,7 +341,7 @@ public function waitForElementUntilIsPresent(By $locator, $timeOutSeconds = 5)
341341
/**
342342
* Wait for current element to be displayed
343343
* @param Integer $timeOutSeconds
344-
* @return \SeleniumClient\WebElement
344+
* @return Nearsoft\SeleniumClient\WebElement
345345
*/
346346
public function waitForElementUntilIsDisplayed($timeOutSeconds = 5)
347347
{
@@ -353,7 +353,7 @@ public function waitForElementUntilIsDisplayed($timeOutSeconds = 5)
353353
/**
354354
* Wait for current element to be enabled
355355
* @param Integer $timeOutSeconds
356-
* @return \SeleniumClient\WebElement
356+
* @return Nearsoft\SeleniumClient\WebElement
357357
*/
358358
public function waitForElementUntilIsEnabled($timeOutSeconds = 5)
359359
{
@@ -366,8 +366,8 @@ public function waitForElementUntilIsEnabled($timeOutSeconds = 5)
366366
* Wait until current element's text has changed
367367
* @param String $targetText
368368
* @param Integer $timeOutSeconds
369-
* @throws SeleniumClient\Exceptions\WebDriverWaitTimeout
370-
* @return \SeleniumClient\WebElement
369+
* @throws Nearsoft\SeleniumClient\Exceptions\WebDriverWaitTimeout
370+
* @return Nearsoft\SeleniumClient\WebElement
371371
*/
372372
public function waitForElementUntilTextIsChanged($targetText, $timeOutSeconds = 5)
373373
{
@@ -393,8 +393,8 @@ public function waitForElementUntilTextIsChanged($targetText, $timeOutSeconds =
393393
* @param By $locator
394394
* @param String $targetText
395395
* @param Integer $timeOutSeconds
396-
* @throws SeleniumClient\Exceptions\WebDriverWaitTimeout
397-
* @return \SeleniumClient\WebElement
396+
* @throws Nearsoft\SeleniumClient\Exceptions\WebDriverWaitTimeout
397+
* @return Nearsoft\SeleniumClient\WebElement
398398
*/
399399
public function waitForElementUntilIsPresentWithSpecificText(By $locator, $targetText, $timeOutSeconds = 5)
400400
{

0 commit comments

Comments
 (0)