"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", "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=1920,1080', // '--headless', // '--disable-gpu', ], ], ); $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', $caps, ); } /** * Execute the console command. * * @return int */ public function handle() { $this->client->get( 'https://www.imdb.com/search/name/?birth_monthday=12-10' ); sleep(1); // If the website is an SPA e.g. React app, we // may need to wait for the content to load, // so instead of getCrawler we use // refreshCrawler(). $crawler = $this->client->refreshCrawler(); $titleElement = $crawler->filterXPath( "//h1[contains(@class, 'ipc-title__text')]" ); $titleText = $titleElement->getText(); $this->info($titleText); $this->client->takeScreenshot('screenshot.jpg'); return 0; } /** * @return string */ private function getInput() { $words = $this->ask('>>'); $this->info($words); return $words; } }