As the title says
The sample reads two columns of Excel in sequence. Just do a Google search with two keywords
However, technically, if you prepare this much, the rest will be applied Automatic input from a huge amount of Excel for web-based slip system I think it is possible to do what is called RPA.
Python 3.8.1 Visual Studio Code 1.41.1 openpyxl 3.0.3 pandas 1.0.3 selenium 3.141.0
sele.py
#Python + Selenium +Automatic operation of Chrome with pandas
import time
from selenium import webdriver
import chromedriver_binary
import pandas as pd
#Open Excel with search words in pandas
search_value_table = pd.read_excel(".\\search_word.xlsx", dtype=str)
#Open Chrome and open Google with selenium. And a little weight
driver = webdriver.Chrome()
driver.get('https://www.google.com/')
time.sleep(2)
#Repeated search
for index, row in search_value_table.iterrows():
#Connect two search terms with a space
search_word = row['Search name 1'] + " " + row['Search name 2']
#Find Google search box find_element_by_name
search_box = driver.find_element_by_name("q")
search_box.send_keys(search_word)
search_box.submit()
time.sleep(2)
#Click the Google logo to go back
driver.find_element_by_id("logo").click();
driver.quit()
Recommended Posts