简体   繁体   English

在开放层中使用硒

[英]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. 无法自动完成对作为svg节点的地图元素的点击(它们没有硒依赖的特定x路径)。我们尝试单击功能也失败,因为它也被设置为svg元素。 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. 这是通过向数据库发出请求以获取要素坐标,然后使用以下方法获取点的x,y坐标的像素值来完成的。

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. 它也适用于所有窗口大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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