18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Sahi and openlayers (openstreetmap)
Hi
We have a web application that uses openlayers (a map is included in our application - http://www.openstreetmap.org/).
In the application we can search a company. After the search, an image appears on the map at the location of the company. When we click on this image, the details of the company will open in a new page. However, I cannot click on the image with sahi.
I've found the id of the image with firebug
I tried to do: _click(_image("OpenLayers.Geometry.Point_120"));
But I got the error: Element undefined.
FYI: This is the html source of the map in our html page. It seems sahi cannot identify any of the elements in this div.
We have a web application that uses openlayers (a map is included in our application - http://www.openstreetmap.org/).
In the application we can search a company. After the search, an image appears on the map at the location of the company. When we click on this image, the details of the company will open in a new page. However, I cannot click on the image with sahi.
I've found the id of the image with firebug
<image id="OpenLayers.Geometry.Point_120" cx="271.9026715417676" cy="170.6002771075382" r="1" x="256" y="155" width="32" height="32" href="/prtr/webResources/images/sectors/PRTRA_1.png" style="opacity: 1" fill="#000000" fill-opacity="1" stroke="#000000" stroke-opacity="1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">)
I tried to do: _click(_image("OpenLayers.Geometry.Point_120"));
But I got the error: Element undefined.
FYI: This is the html source of the map in our html page. It seems sahi cannot identify any of the elements in this div.
<div class="olMapViewport olControlDragPanActive olControlZoomBoxActive olControlPinchZoomActive olControlNavigationActive olControlSelectFeatureActive" style="position: relative; overflow: hidden; width: 100%; height: 100%;" id="OpenLayers.Map_12_OpenLayers_ViewPort"><div style="position: absolute; width: 100%; height: 100%; z-index: 999;" id="OpenLayers.Map_12_events"><div style="position: absolute; z-index: 749; left: 0px; top: 0px;" id="OpenLayers.Map_12_OpenLayers_Container"><div class="olLayerDiv" dir="ltr" style="position: absolute; width: 100%; height: 100%; z-index: 100;" id="OpenLayers.Layer.OSM.OsmarenderLocalProxy_2"><div style="overflow: hidden; position: absolute; z-index: 1; left: 652px; top: 241px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/132/86.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv90"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 396px; top: 241px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/131/86.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv92"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 140px; top: 241px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/130/86.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv94"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: -116px; top: 241px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/129/86.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv96"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: -116px; top: 497px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/129/87.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv98"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 140px; top: 497px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/130/87.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv100"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 396px; top: 497px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/131/87.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv102"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 652px; top: 497px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/132/87.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv104"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 908px; top: 497px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/133/87.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv106"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 908px; top: 241px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/133/86.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv108"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 908px; top: -15px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/133/85.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv110"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 652px; top: -15px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/132/85.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv112"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 396px; top: -15px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/131/85.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv114"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: 140px; top: -15px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/130/85.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv116"></div><div style="overflow: hidden; position: absolute; z-index: 1; left: -116px; top: -15px; width: 256px; height: 256px;"><img src="/prtr/proxy?url=http://tile.openstreetmap.org/8/129/85.png" class="olTileImage" style="width: 256px; height: 256px; position: relative;" id="OpenLayersDiv118"></div></div><div class="olLayerDiv" dir="ltr" style="position: absolute; width: 100%; height: 100%; z-index: 330; left: 0px; top: 0px;" id="OpenLayers.Layer.Vector_10"><svg viewBox="0 0 820 400" height="400" width="820" id="OpenLayers.Layer.Vector_10_svgRoot"></svg></div><div class="olLayerDiv" dir="ltr" style="position: absolute; width: 100%; height: 100%; z-index: 725; left: 0px; top: 0px;" id="OpenLayers.Layer.Vector.RootContainer_64"><svg viewBox="0 0 820 400" height="400" width="820" id="OpenLayers.Layer.Vector.RootContainer_64_svgRoot"><g transform="" style="visibility: visible;" id="OpenLayers.Layer.Vector.RootContainer_64_root"><g id="OpenLayers.Layer.Vector.RootContainer_64_vroot"></g><g id="OpenLayers.Layer.Vector.RootContainer_64_troot"></g></g><g transform="" style="visibility: visible;" id="OpenLayers.Layer.Vector_10_root"><g id="OpenLayers.Layer.Vector_10_vroot"><image stroke-linejoin="round" stroke-linecap="round" stroke-width="2" stroke-opacity="1" stroke="#000000" fill-opacity="1" fill="#000000" style="opacity: 1" xlink:href="/prtr/webResources/images/sectors/PRTRA_1.png" height="32" width="32" y="155" x="256" r="1" cy="170.6002771075382" cx="271.9026715417676" id="OpenLayers.Geometry.Point_120"></image><image stroke-linejoin="round" stroke-linecap="round" stroke-width="2" stroke-opacity="1" stroke="#000000" fill-opacity="1" fill="#000000" style="opacity: 1" xlink:href="/prtr/webResources/images/sectors/PRTRA_1.png" height="32" width="32" y="76" x="196" r="1" cy="92.13150519299597" cx="212.2918814200653" id="OpenLayers.Geometry.Point_123"></image><image stroke-linejoin="round" stroke-linecap="round" stroke-width="2" stroke-opacity="1" stroke="#000000" fill-opacity="1" fill="#000000" style="opacity: 1" xlink:href="/prtr/webResources/images/sectors/PRTRA_1.png" height="32" width="32" y="165" x="176" r="1" cy="181.32949769620973" cx="191.6482110927396" id="OpenLayers.Geometry.Point_126"></image></g><g id="OpenLayers.Layer.Vector_10_troot"></g></g></svg></div></div></div><div unselectable="on" class="olControlPanZoom olControlNoSelect" style="position: absolute; left: 4px; top: 4px; z-index: 1004;" id="OpenLayers.Control.PanZoom_15"><div style="position: absolute; left: 13px; top: 4px; width: 18px; height: 18px; cursor: pointer;" id="OpenLayers.Control.PanZoom_15_panup"><img src="/prtr/webResources/scripts/open_layers/img/north-mini.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers.Control.PanZoom_15_panup_innerImage"></div><div style="position: absolute; left: 4px; top: 22px; width: 18px; height: 18px; cursor: pointer;" id="OpenLayers.Control.PanZoom_15_panleft"><img src="/prtr/webResources/scripts/open_layers/img/west-mini.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers.Control.PanZoom_15_panleft_innerImage"></div><div style="position: absolute; left: 22px; top: 22px; width: 18px; height: 18px; cursor: pointer;" id="OpenLayers.Control.PanZoom_15_panright"><img src="/prtr/webResources/scripts/open_layers/img/east-mini.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers.Control.PanZoom_15_panright_innerImage"></div><div style="position: absolute; left: 13px; top: 40px; width: 18px; height: 18px; cursor: pointer;" id="OpenLayers.Control.PanZoom_15_pandown"><img src="/prtr/webResources/scripts/open_layers/img/south-mini.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers.Control.PanZoom_15_pandown_innerImage"></div><div style="position: absolute; left: 13px; top: 63px; width: 18px; height: 18px; cursor: pointer;" id="OpenLayers.Control.PanZoom_15_zoomin"><img src="/prtr/webResources/scripts/open_layers/img/zoom-plus-mini.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers.Control.PanZoom_15_zoomin_innerImage"></div><div style="position: absolute; left: 13px; top: 81px; width: 18px; height: 18px; cursor: pointer;" id="OpenLayers.Control.PanZoom_15_zoomworld"><img src="/prtr/webResources/scripts/open_layers/img/zoom-world-mini.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers.Control.PanZoom_15_zoomworld_innerImage"></div><div style="position: absolute; left: 13px; top: 99px; width: 18px; height: 18px; cursor: pointer;" id="OpenLayers.Control.PanZoom_15_zoomout"><img src="/prtr/webResources/scripts/open_layers/img/zoom-minus-mini.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers.Control.PanZoom_15_zoomout_innerImage"></div></div><div unselectable="on" class="olControlArgParser olControlNoSelect" style="position: absolute; z-index: 1004;" id="OpenLayers.Control.ArgParser_16"></div><div unselectable="on" class="olControlAttribution olControlNoSelect" style="position: absolute; z-index: 1004;" id="OpenLayers.Control.Attribution_17">Data CC-By-SA by <a href="http://openstreetmap.org/">OpenStreetMap</a></div><div unselectable="on" class="olControlLayerSwitcher olControlNoSelect" style="position: absolute; padding-top: 0pt; padding-bottom: 0pt; width: 0px; height: 0px; z-index: 1005;" id="OpenLayers.Control.LayerSwitcher_49"><div style="background-color: transparent;"><span style="background-color: darkblue; display: block; height: 1px; overflow: hidden; font-size: 1px; margin-left: 5px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span><span style="background-color: darkblue; display: block; height: 1px; overflow: hidden; font-size: 1px; margin-left: 3px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span><span style="background-color: darkblue; display: block; height: 1px; overflow: hidden; font-size: 1px; margin-left: 2px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span><span style="background-color: darkblue; display: block; height: 2px; overflow: hidden; font-size: 1px; margin-left: 1px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span></div><div style="opacity: 0.75; display: none;" class="layersDiv" id="OpenLayers.Control.LayerSwitcher_49_layersDiv"><div style="" class="baseLbl">Base Layer</div><div class="baseLayersDiv"><input checked="checked" value="Osmarender (local proxy)" name="OpenLayers.Control.LayerSwitcher_49_baseLayers" id="OpenLayers.Control.LayerSwitcher_49_input_Osmarender (local proxy)" type="radio"><span style="vertical-align: bottom;" class="labelSpan">Osmarender (local proxy)</span><br></div><div style="" class="dataLbl">Overlays</div><div class="dataLayersDiv"><input checked="checked" value="Exploitaties" name="Exploitaties" id="OpenLayers.Control.LayerSwitcher_49_input_Exploitaties" type="checkbox"><span style="vertical-align: baseline;" class="labelSpan">Exploitaties</span><br></div></div><div style="background-color: transparent;"><span style="background-color: darkblue; display: block; height: 2px; overflow: hidden; font-size: 1px; margin-left: 1px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span><span style="background-color: darkblue; display: block; height: 1px; overflow: hidden; font-size: 1px; margin-left: 2px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span><span style="background-color: darkblue; display: block; height: 1px; overflow: hidden; font-size: 1px; margin-left: 3px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span><span style="background-color: darkblue; display: block; height: 1px; overflow: hidden; font-size: 1px; margin-left: 5px; margin-right: 0px; border-left-width: 0px; border-right-width: 0px; opacity: 0.75;"></span></div><div class="maximizeDiv" style="position: absolute; width: 18px; height: 18px;" id="OpenLayers_Control_MaximizeDiv"><img src="/prtr/webResources/scripts/open_layers/img/layer-switcher-maximize.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers_Control_MaximizeDiv_innerImage"></div><div class="minimizeDiv" style="position: absolute; width: 18px; height: 18px; display: none;" id="OpenLayers_Control_MinimizeDiv"><img src="/prtr/webResources/scripts/open_layers/img/layer-switcher-minimize.png" style="position: relative; width: 18px; height: 18px;" id="OpenLayers_Control_MinimizeDiv_innerImage"></div></div><div unselectable="on" class="olControlSelectFeature olControlNoSelect" style="position: absolute; z-index: 1006;" id="OpenLayers.Control.SelectFeature_63"></div></div>
Comments
I also tried to use Sahi in an application where there is a map.
I have a similar html code.
I tried different ways to try to select a specific area with the html code but no success.
I thought by using the mouseposition (it shows x and y coordinates), i could have solved my issue but still no.
@wgoris: Have you found a way?
The map is built on several layers but Sahi only sees one. Is there any way for Sahi to take into account another layer with more precised data?