我无法创建一个Selenium测试用例来自动点击Google Maps(具体来说,是通过在地图上单击来创建标记)。
Record function in IDE
The "Record" function records my mouse click as
<tr> <td>click</td> <td>//div[@id='map_canvas']/div[3]/div/div/div[4]/div/div/div[5]</td> <td></td> </tr>
When executing the command, this not only places the marker way outside the visible map view, but it is also not reliable on page refresh because the GMap nested div structure changes every time.
clickAt
Here it was suggested to use clickAt with the outside div's div, like so:
<tr> <td>clickAt</td> <td>//div[@id='map_canvas']/div/div[1]</td> <td>(400,300)</td> </tr>
This does not work at all. I have tried every variation of click, clickAt, and mouseDown/mouseUp that I can think of, but nothing seems to register.
编辑:看起来Google的方法(以及我找到的所有其他方法)不起作用的原因是我正在使用Google Maps API v3。Google自己的Selenium测试似乎在使用v2。