Skip to content

Commit

Permalink
Add custom Chrome options with GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
kkamara committed Mar 17, 2024
1 parent c26f1fd commit 3d189f5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
17 changes: 14 additions & 3 deletions app/Console/Commands/BrowserScrape.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ public function __construct()
"browserstack.networkLogs" => true,
"disableCorsRestrictions" => true,
"wsLocalSupport" => true,
"geoLocation" => "GB"
"geoLocation" => "GB",
"goog:chromeOptions" => [
"args" => [
'--disable-popup-blocking',
'--disable-application-cache',
'--disable-web-security',
'--start-maximized',
'--ignore-certificate-errors',
'--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36',
'--window-size=1200,1100',
// '--headless',
// '--disable-gpu',
],
],
);
$caps = DesiredCapabilities::chrome();
foreach ($capabilities as $key => $value) {
Expand All @@ -51,8 +64,6 @@ public function __construct()
$this->client = Client::createSeleniumClient(
'http://localhost:'.config('app.selenium_grid_port').'/wd/hub',
$caps,
null,
[],
);
}

Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ php artisan browser:scrape

[Capabilities](https://www.browserstack.com/docs/automate/capabilities).

[Using Desired Capabilities](https://chromedriver.chromium.org/capabilities#h.p_ID_52).

## Adding a new command <a name="adding-commands"></a>

```bash
Expand Down
15 changes: 14 additions & 1 deletion storage/app/NewCrawler2024.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,20 @@ public function __construct()
"browserstack.networkLogs" => true,
"disableCorsRestrictions" => true,
"wsLocalSupport" => true,
"geoLocation" => "GB"
"geoLocation" => "GB",
"goog:chromeOptions" => [
"args" => [
'--disable-popup-blocking',
'--disable-application-cache',
'--disable-web-security',
'--start-maximized',
'--ignore-certificate-errors',
'--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36',
'--window-size=1200,1100',
// '--headless',
// '--disable-gpu',
],
],
);
$caps = DesiredCapabilities::chrome();
foreach ($capabilities as $key => $value) {
Expand Down

0 comments on commit 3d189f5

Please sign in to comment.