-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,13 @@ class Options | |
*/ | ||
public static $arguments = []; | ||
|
||
/** | ||
* Apply `ChromeOptions` configuration using a callback. | ||
* | ||
* @var (\Closure(\Facebook\WebDriver\Chrome\ChromeOptions):(void)):null | ||
*/ | ||
public static $chromeOptionsCallback = null; | ||
|
||
/** | ||
* Reset arguments. | ||
* | ||
|
@@ -54,6 +61,19 @@ public static function resetArguments(): void | |
static::$arguments = []; | ||
} | ||
|
||
/** | ||
* Set `ChromeOptions` callback. | ||
* | ||
* @param (\Closure(\Facebook\WebDriver\Chrome\ChromeOptions):(void)):null $callback | ||
* @return static | ||
*/ | ||
public static function using($callback) | ||
Check failure on line 70 in src/Options.php
|
||
{ | ||
static::$chromeOptionsCallback = $callback; | ||
|
||
return new static(); | ||
} | ||
|
||
/** | ||
* Add a browser option. | ||
* | ||
|
@@ -231,6 +251,8 @@ public static function getChromeOptions() | |
if (static::$w3cCompliant === false) { | ||
$option->setExperimentalOption('w3c', static::$w3cCompliant); | ||
} | ||
|
||
value(static::$chromeOptionsCallback); | ||
})->addArguments(static::$arguments); | ||
} | ||
} |