-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoogleSearch.py
More file actions
20 lines (19 loc) · 784 Bytes
/
GoogleSearch.py
File metadata and controls
20 lines (19 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
searchtext="Coding Blocks"
driver = webdriver. Chrome()
driver.get("https://www.google.com")
element = driver.find_element_by_xpath('//*[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input')
element.send_keys(searchtext)
element = driver.find_element_by_xpath('//*[@id="tsf"]/div[2]/div[1]/div[3]/center/input[1]')
element.click()
driver.close()
searchtext="Coding Blocks"
driver = webdriver. Chrome()
driver.get("https://www.google.com")
element = driver.find_element_by_xpath('//*[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input')
element.send_keys(searchtext)
element = driver.find_element_by_xpath('//*[@id="tsf"]/div[2]/div[1]/div[3]/center/input[1]')
element.click()
driver.close()