Comments (2)
I ended up facing the same problem as you. Even when running in debug mode, I would have to manually click the new window for it to start working.
I added the following lines of code to the sort_by function in googlemaps.py, and while I now get reviews back, the Autofocus error is still outputted. This may be a temporary fix but you can give it a try for now til someone else can fix it properly.
# move to sort button
sort_element = self.driver.find_element(By.XPATH, '//button[@data-value=\'Sort\']')
actions = ActionChains(self.driver)
actions.move_to_element(sort_element).perform()
The new sort_by function looks like this
def sort_by(self, url, ind):
self.driver.get(url)
#self.__click_on_cookie_agreement()
# move to sort button
sort_element = self.driver.find_element(By.XPATH, '//button[@data-value=\'Sort\']')
actions = ActionChains(self.driver)
actions.move_to_element(sort_element).perform()
wait = WebDriverWait(self.driver, MAX_WAIT)
# open dropdown menu
clicked = False
tries = 0
while not clicked and tries < MAX_RETRY:
try:
menu_bt = wait.until(EC.element_to_be_clickable((By.XPATH, '//button[@data-value=\'Sort\']')))
menu_bt.click()
clicked = True
time.sleep(3)
except Exception as e:
tries += 1
self.logger.warn('Failed to click sorting button')
# failed to open the dropdown
if tries == MAX_RETRY:
return -1
# element of the list specified according to ind
recent_rating_bt = self.driver.find_elements_by_xpath('//div[@role=\'menuitemradio\']')[ind]
recent_rating_bt.click()
# wait to load review (ajax call)
time.sleep(5)
return 0
from googlemaps-scraper.
Does this supposed to open a Chrome test software window? Because there's no Chrome windows appeared once I ran the script. I got the same output as well, the reviews is 0. Already applied the solution above as well but still 0
from googlemaps-scraper.
Related Issues (20)
- Any chance of an update? HOT 2
- Missing pandas and numpy in requirements.txt HOT 1
- Fails to click the sorting button HOT 1
- unexpected keyword argument 'log_level' HOT 3
- Fails on [Review 0] HOT 5
- selenium.common.exceptions.NoSuchElementException: Message: no such element: HOT 6
- Expanding Reviews HOT 1
- Googlemaps business info HOT 2
- Stale Element Reference Error HOT 5
- `__expand_reviews` sometimes not working HOT 1
- "Uncaught RangeError: Maximum call stack size exceeded" error HOT 1
- Parallelism HOT 1
- emails HOT 1
- Fails to click sorting button HOT 2
- Maximum call stack size exceeded HOT 2
- relative date and rating not parsed HOT 1
- ValueError: There is no such driver by url https://chromedriver.storage.googleapis.com/LATEST_RELEASE_115.0.5790
- webdriver_manager pointing to browser version instead of driver version? HOT 2
- possible confilcting requirements HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from googlemaps-scraper.