Hi everyone!
Can i get some help with running Selenium please ? I have followed the instructions on the selenium FAQ page. I am currently on Python = 3.10 Selenium 4.7.2
def data_place_crawler():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
driver = webdriver.Chrome(options=chrome_options) #line 23 - 24 for hosting test
try:
dfPlace = []
#time.sleep(100)
foodID_list =[]
businessName_list =[]
url_list =[]
food_list = (pd.read_csv("place_url.csv")['foodid'])
placeURL_list = (pd.read_csv("place_url.csv")['placeURL'])
foodPlace_dict = dict(zip(food_list, placeURL_list))
for food, url in foodPlace_dict.items():
driver.get(url)
time.sleep(3)
#Find scroll layout
scrollable_div = driver.find_element(By.XPATH, '//*
[@id="QA0Szd"]/div/div/div[1]/div[2]/div/div[1]/div/div/div[2]/div[1]')
#Scroll as many times as necessary to load all reviews
for i in range(0,2):
driver.execute_script('arguments[0].scrollTop = arguments[0].scrollHeight',
scrollable_div)
time.sleep(3)
businessDetail = driver.find_elements(By.CLASS_NAME, "hfpxzc")
for lnk in businessDetail:
foodID_list.append(food)
businessName_list.append(lnk.get_attribute('aria-label'))
url_list.append(lnk.get_attribute('href'))
df = pd.DataFrame(list(zip(foodID_list,businessName_list, url_list)),
columns=['Food ID','Business Name', 'URL Link'])
print(df)
df.to_csv('/home/smtan041/FYP/google_place.csv',index=False)
dfPlace = df.values.tolist()
messageComplete = "Completed!"
return dfPlace , messageComplete
finally:
driver.quit()
But when I check my logs all I got was :
Incompatible release of chromedriver (version 90.0.4430.24) detected in PATH: /usr/local/bin/chromedriver
I do not have a local chromedriver being used, so I can get some guidance how to get this running ?
My most sincere thanks in advance, Smtan041