Skip to content

Commit

Permalink
Merge pull request #354 from inxilpro/optional-logs
Browse files Browse the repository at this point in the history
Handle case where GET_LOG is not supported
  • Loading branch information
taylorotwell authored Sep 7, 2017
2 parents 345d5a6 + 26d7783 commit d0f4277
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Str;
use Illuminate\Support\Traits\Macroable;
use Facebook\WebDriver\WebDriverDimension;
use Facebook\WebDriver\Remote\WebDriverBrowserType;

class Browser
{
Expand Down Expand Up @@ -42,6 +43,17 @@ class Browser
*/
public static $storeConsoleLogAt;

/**
* The browsers that support retrieving logs.
*
* @var array
*/
public static $supportsRemoteLogs = [
WebDriverBrowserType::CHROME,
WebDriverBrowserType::SAFARI,
WebDriverBrowserType::PHANTOMJS,
];

/**
* Get the callback which resolves the default user to authenticate.
*
Expand Down Expand Up @@ -229,7 +241,7 @@ public function screenshot($name)
*/
public function storeConsoleLog($name)
{
if (static::$storeConsoleLogAt) {
if (in_array($this->driver->getCapabilities()->getBrowserName(), static::$supportsRemoteLogs)) {
$console = $this->driver->manage()->getLog('browser');

if (!empty($console)) {
Expand Down

0 comments on commit d0f4277

Please sign in to comment.