0

I'm new with Selenium, actually I'm trying it since yesterday, found some stuff interesting with Selenium with python.

I found some information regarding how to scrape and interact with JS page. But my doubt is how can I get a data from a clickable map with selenium. I tried to found if there are any hidden links in the page, but there aren't any of them. I figured out that when I move my mouse over the map in any button (in the map) there is a change in x,y position (of course...) and after I click in the button I can scrape my data. Using a static model I could scrape all the data that I want.

So my question is, how can I simulate the mouse movement over the map and this click action?

Best regards,

1 Answer 1

1

If you have x,y position on map and length, width of map, then you can try something like

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.your_web_page.com") # specify webpage
element=driver.find_elements_by_xpath("provide_map_selector") # specify correct xpath
x = 25 # set actual value
y = 50 # set actual value
length = 500 # set actual value
width = 300 # set actual value
action = webdriver.common.action_chains.ActionChains(driver)
action.move_to_element_with_offset(element, width - y, length - x)
action.click()
action.perform()
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, although I couldn't use it for my problem, it helped me to figure out one solution!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.