I am trying to scrape GPS coordinates off an embedded Google map on a property website (link)
The relevant data is under this block of HTML:
<a target="_blank" rel="noopener" href="https://maps.google.com/maps?ll=51.517204,-0.126447&z=15&t=m&hl=en-GB&gl=US&mapclient=apiv3" title="Open this area in Google Maps (opens a new window)" style="position: static; overflow: visible; float: none; display: inline;"><div style="width: 66px; height: 26px; cursor: pointer;"><img alt="" src="https://maps.gstatic.com/mapfiles/api-3/images/google_white5_hdpi.png" draggable="false" style="position: absolute; left: 0px; top: 0px; width: 66px; height: 26px; user-select: none; border: 0px; padding: 0px; margin: 0px;"></div></a>
However that bit is located on the Map & Nearby
tab, which I am having troubles accessing
I have tried the following:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains
import time
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_experimental_option('useAutomationExtension', False)
PATH = r"...\chromedriver.exe"
driver = webdriver.Chrome(executable_path=PATH, options=chromeOptions, desired_capabilities=chromeOptions.to_capabilities())
url = 'https://www.primelocation.com/new-homes/details/55357965?search_identifier=d10d089a335cc707245fb6c924bafbd2'
driver.get(url)
link = driver.find_element_by_link_text("Map & Nearby")
actions = ActionChains(driver)
actions.click(link)
And few other combinations of find_element_xyz
, however with no success
The question I have is: how can I access the Map & Nearby
tab?
Aucun commentaire:
Enregistrer un commentaire