Aug-30-2023, 10:58 AM
(Aug-28-2023, 12:12 PM)snippsat Wrote: To use this older code should fist makevirtual environment
and clone Repo a use older Python version,then dopip install -r requirements.txt
I did a quick test and this codedos not work
anymore,have to do a rewrite of code as there are servals problems.
Code use Selenium and and goes to Google for search,Google has of course changed since 2018.
Also Selenium has changes so need some Path fix,before comes to this error.
From code:
""" Search on Google and returns the list of PAA questions in SERP. """ def newSearch(browser,query): if lang== "en": browser.get("https://www.google.com?hl=en") searchbox = browser.find_element_by_xpath("//input[@aria-label='Search']") else: browser.get("https://www.google.com?hl=es") searchbox = browser.find_element_by_xpath("//input[@aria-label='Buscar']") searchbox.send_keys(query)
Error:selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@aria-label='Search']"}
Hi Snippat,
Apologies for the late reply. Thank you for taking the time to even try it out yourself and report back that the code has issues. Super helpful as I hadn't got that far! At least now I'm a little more competent in creating a virtual environment with different versions of packages. Very kind of you to even try the code out yourself mate.
Have a great week.