The Wayback Machine - https://web.archive.org/web/20240118182126/https://www.geeksforgeeks.org/search-google-using-python-selenium/
Open In App
Related Articles

Search Google Using Python Selenium

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Selenium’s Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way. This article illustrates about how to use Selenium Python to write your first program with Selenium to Search Google Using Python Selenium.

If you have not installed Selenium and its components yet, install them from here – Selenium Python Introduction and Installation.

How to search google using Python Selenium

Google search has a URL where you can append your keywords and it will search the keyword for you. For example – “https://google.co.in/search?q=gfg”, this will search gfg on google.co.in.In the same manner we arbitrarily provide the keyword we want to search or take input from user. This is an example program to understand how Selenium works.

After you have installed Selenium, create a file called run.py as –
Program –




# Python program to demonstrate
# selenium
  
# import webdriver
from selenium import webdriver
  
# create webdriver object
driver = webdriver.Firefox()
  
# enter keyword to search
keyword = "geeksforgeeks"
  
# get google.co.in
driver.get("https://google.co.in / search?q ="+keyword)


Output-

search-google-using-python-selenium

Don't miss your chance to ride the wave of the data revolution! Every industry is scaling new heights by tapping into the power of data. Sharpen your skills, become a part of the hottest trend in the 21st century.
Dive into the future of technology - explore the Complete Machine Learning and Data Science Program by GeeksforGeeks and stay ahead of the curve.

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 04 Jan, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials