Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Jun 15, 2024
1 parent ca22c20 commit 231d547
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,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.
*
Expand All @@ -47,6 +54,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)
{
static::$chromeOptionsCallback = $callback;

return new static();
}

/**
* Add a browser option.
*
Expand Down Expand Up @@ -216,6 +236,8 @@ public static function getChromeOptions()
if (static::$w3cCompliant === false) {
$option->setExperimentalOption('w3c', static::$w3cCompliant);
}

value(static::$chromeOptionsCallback);
})->addArguments(static::$arguments);
}
}

0 comments on commit 231d547

Please sign in to comment.