Issue
Im trying to get the location for sotre from google maps but my code sometimes gets it for a store and sometimes it doesnt get it for another. here the link to the google colab
https://colab.research.google.com/drive/1ncrffQMGyeudUkMiGSrCfssifVScfYa-?usp=sharing
you can see in the end that it gets it for "blaze" and not for "apple" or "ferrari"
why and how can this be?
NOTE: it is NOT about the page having to load, i made it wait up until 20 seconds and it still does not work.
i expect to get the location for each link i give it to it
Solution
Each page has different page structure, so you need to point the element using a relative xpath. So, change this line
location = driver.find_element('xpath','//*[@id="QA0Szd"]/div/div/div[1]/div[2]/div/div[1]/div/div/div[11]/div[3]/button/div[1]/div[2]/div[1]').text
with this one
location = driver.find_element('xpath','//button[@data-item-id="address"]').text
Answered By - Eugeny Okulik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.