From 0604f85d9f180cc0a31ee1d230b2fcc0b4770ee0 Mon Sep 17 00:00:00 2001 From: kkamara Date: Sat, 16 Mar 2024 21:27:23 +0000 Subject: [PATCH] Add missing web crawler template file --- storage/app/NewCrawler2024.php | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 storage/app/NewCrawler2024.php diff --git a/storage/app/NewCrawler2024.php b/storage/app/NewCrawler2024.php new file mode 100644 index 0000000..4d4dcbc --- /dev/null +++ b/storage/app/NewCrawler2024.php @@ -0,0 +1,63 @@ +client = Client::createSeleniumClient( + 'http://localhost:'.config('app.selenium_grid_port').'/wd/hub' + ); + } + + /** + * @return void + */ + private function getInput() { + $words = $this->ask('>>'); + $this->info($words); + } + + /** + * Execute the console command. + * + * @return int + */ + public function handle() + { + $this->client + ->get('https://www.imdb.com/search/name/?birth_monthday=12-10'); + $crawler = $this->client->getCrawler(); + $preferences = $crawler->filterXPath('//button[@data-testid="accept-button"]'); + $preferences->click(); + $element = $crawler->filterXPath('//h3[text()="1. Kenneth Branagh"]'); + $element->click(); + $this->client->takeScreenshot($saveAs = 'screenshot.jpg'); + + return 0; + } +}