简体   繁体   中英

Using selenium with Open Layers

It is not possible to automate the clicks on the map elements which are svg nodes (they do not have specific x-paths which selenium relies on).We tried clicking on features which also fails as it is also set as a svg element. Is there a solution for this?

I have finally found a solution for this (at least for point feature types). It is done using issuing a request to the DB to get the feature coordinates and then using the following method to get the pixel values for the x,y coordinates for the points.

OpenLayers.getPixelFromLonLat()

After that the Open Layers click controller is used to issue a request to the given pixel. It works on all window sizes as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM