Placing an embedded google map marker with Selenium

巧了我就是萌 提交于 2019-12-06 07:46:19

问题


I have an asp.net website which as part of a wizard uses an embedded google map to select a location by clicking on the map to place a marker. How do I automate this with Selenium?

In particular I've tried:

  • ClickAt
  • DoubleClickAt
  • MouseDownAt
  • MouseUpAt

In all cases passing the map div id as the locator and "100,100" as the coordinate.

I don't care where on the map the marker is placed, as long as I can place that marker.


回答1:


The command:

<tr>
    <td>clickAt</td>
    <td>//div[@id='gmap']/div/div[1]</td>
    <td>(400,300)</td>
</tr>

works for me.




回答2:


Google have "Open Sourced" all their Selenium test scripts for google maps. I'm pretty sure you can find a lot of code to reuse from their scripts.

http://code.google.com/p/gmaps-api-issues/wiki/SeleniumTests



来源:https://stackoverflow.com/questions/2589039/placing-an-embedded-google-map-marker-with-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!