Skip to content

Commit

Permalink
Disable search engine choice pop-up in Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed Aug 15, 2024
1 parent 440bf76 commit 06f210b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Selenium/CapabilitiesResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Lmc\Steward\Selenium;

use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\WebDriverBrowserType;
use Facebook\WebDriver\Remote\WebDriverCapabilityType;
Expand Down Expand Up @@ -101,6 +102,9 @@ protected function setupBrowserSpecificCapabilities(
case WebDriverBrowserType::IE:
$capabilities = $this->setupInternetExplorerCapabilities($capabilities);
break;
case WebDriverBrowserType::CHROME:
$capabilities = $this->setupChromeCapabilities($capabilities);
break;
}

return $capabilities;
Expand All @@ -113,4 +117,14 @@ protected function setupInternetExplorerCapabilities(DesiredCapabilities $capabi

return $capabilities;
}

private function setupChromeCapabilities(DesiredCapabilities $capabilities): DesiredCapabilities
{
$chromeOptions = new ChromeOptions();
// Disable search engine choice pop-up which appears in Chrome 127+
$chromeOptions->addArguments(['--disable-search-engine-choice-screen']);
$capabilities->setCapability(ChromeOptions::CAPABILITY, $chromeOptions);

return $capabilities;
}
}

0 comments on commit 06f210b

Please sign in to comment.