Automatic Google Search using Python Selenium

engrmahabub
Mahabubur Rahman
Published on Oct, 08 2023 1 min read 0 comments
image

You can automatically search Google using Python Selenium. This may take you roughly 2 minutes. Selenium is a popular web application testing framework. It is also used in web scraping.

Installation 

1. Selenium - 

pip install selenium

2. Chrome Browser

Download Chrome browser if you have not installer yet. The download is here.
3. Chrome Driver 

You also need to download chrome driver. For this you need to know what chrome browser you installed from here. Download the same chrome driver version you see the About Chrome section. You can download chrome driver from here.

Create a python file named  script.py the write the bellow code.

from selenium import webdriver
search_string='Beautiful Bangladesh'
search_string = search_string.replace(' ', '+')
browser = webdriver.Chrome('chromedriver')
search_result = browser.get("https://www.google.com/search?q=" + search_string + "&start=" + str(i))

Now save and run it. 

python  script.py

 

 

0 Comments