Skip to content

Commit

Permalink
Add capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
kkamara committed Mar 17, 2024
1 parent 4416c18 commit c26f1fd
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
24 changes: 23 additions & 1 deletion app/Console/Commands/BrowserScrape.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Symfony\Component\Panther\Client;
use Facebook\WebDriver\Remote\DesiredCapabilities;

class BrowserScrape extends Command
{
Expand All @@ -29,8 +30,29 @@ class BrowserScrape extends Command
public function __construct()
{
parent::__construct();
$capabilities = array( // See https://www.browserstack.com/docs/automate/capabilities
"os" => "Windows",
"os_version" => "11",
"browser" => "Chrome",
"browser_version" => "latest",
"name" => "Test",
"build" => "Build 1.0",
"browserstack.debug" => true,
"browserstack.console" => "info",
"browserstack.networkLogs" => true,
"disableCorsRestrictions" => true,
"wsLocalSupport" => true,
"geoLocation" => "GB"
);
$caps = DesiredCapabilities::chrome();
foreach ($capabilities as $key => $value) {
$caps->setCapability($key, $value);
}
$this->client = Client::createSeleniumClient(
'http://localhost:'.config('app.selenium_grid_port').'/wd/hub'
'http://localhost:'.config('app.selenium_grid_port').'/wd/hub',
$caps,
null,
[],
);
}

Expand Down
24 changes: 23 additions & 1 deletion storage/app/NewCrawler2024.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Symfony\Component\Panther\Client;
use Facebook\WebDriver\Remote\DesiredCapabilities;

class NewCrawler2024 extends Command
{
Expand All @@ -29,8 +30,29 @@ class NewCrawler2024 extends Command
public function __construct()
{
parent::__construct();
$capabilities = array( // See https://www.browserstack.com/docs/automate/capabilities
"os" => "Windows",
"os_version" => "11",
"browser" => "Chrome",
"browser_version" => "latest",
"name" => "Test",
"build" => "Build 1.0",
"browserstack.debug" => true,
"browserstack.console" => "info",
"browserstack.networkLogs" => true,
"disableCorsRestrictions" => true,
"wsLocalSupport" => true,
"geoLocation" => "GB"
);
$caps = DesiredCapabilities::chrome();
foreach ($capabilities as $key => $value) {
$caps->setCapability($key, $value);
}
$this->client = Client::createSeleniumClient(
'http://localhost:'.config('app.selenium_grid_port').'/wd/hub'
'http://localhost:'.config('app.selenium_grid_port').'/wd/hub',
$caps,
null,
[],
);
}

Expand Down

0 comments on commit c26f1fd

Please sign in to comment.