Click on specific item in an esriMapLayer?


#1

Our website uses esriMapLayers within an esriMapContainer. We then overlay any number of layers on top of that, and to use the app, the user simply clicks on a location in the map to perform some action. I don’t see an obvious way to do that with Webtestit. Is it possible? Here’s a screenshot of the Elements snippet that contains the layer I need to access and click on (It’s highlighted in gray). If I’m unable to perform reliable click actions on my map, I won’t be able to use Webtestit, and I really like its simplicity in test creation. Thanks!


#2

Hello @ohrnsk,

thanks for reaching out to us. Could you give us some hints at what exactly isn’t working? Aren’t you able to find the appropriate element in a stable way? It sounds like this is more of an issue of a proper selector creation instead of actual Selenium code. With respect to the later if you can express it with Selenium you can do it with Webtestit since its not a custom framework per se but merely leverages the existing Selenium APIs.

Furthermore if you could create a minimalistic sample, publicly available so we can try to replicate the scenario, this would help tremendously to help us find a solution for you.


#3

Hi, thanks for getting back to me. I’ll do my best to provide more info, but I have a feeling it won’t help. The main problem is that we are displaying data layers on top of a map pane. I need to be able to click on a particular displayed item from one of the layers. There are no elements to click on. The code snippet I sent earlier is exactly what I see in the Elements tab when viewing my web page’s code. I almost need coordinates on which to click, but those could change if the map is moved at all (or displayed at a different resolution). I struggled with this same issue when trying to automate our web app using Ranorex. I was hoping Webtestit could handle clicks on a map better. I can’t send a sample, but here’s a screencast showing some of what I need to do - https://www.screencast.com/t/X4WQ28YizTS. If I can’t click on a particular item or location on the map, is there a way I can just draw a box on a map with Webtestit? That might help with some of my automation.


#4

Yeah I think I see where your issue is coming from. I thought exactly of the click approach using coordinates before but ended up with the same concerns of what happens if the map moves around or gets displayed with various stylings/sizes due to responsive design.

I’m not too familiar with ESRI but I know there are multiple ways to represent the map. E.g take a look at this sample If I would want to select Ontario I’d see that its represented as an SVG so there is a chance to target the individual path.
Without seeing your sample, even a dummied down one would help, it’s really hard to propose a solution.

In general you’d always need a way to select your target element in Selenium, same applies for Ranorex Studio using a kind of css/xpath selector. If the target is no HTMLElement, but as depicted in the sample a SVGElement and you’re looking for an inner child, then you’d have to work around using an injected JavaScript. But even in your example if there is an image, there must be an association which tells which region of the image interacts with whatever. Like an image-map or the sorts.
So whatever it is it must somehow be represented in the DOM, or perhaps hidden in ShadowDOM, in order for the browser to pick it up. Alternatively the logic might reside in the code but that again means it’s back to coordinate calcs.

This problem has nothing to do with either Selenium or Ranorex Studio. It’s just a tricky scenario which will need a bit more thinking, but I’m sure we can find a solution :wink:

EDIT:
Last but not least, there still if everything fails is the possibility to request the EsriJS API directly from within a testcase, obtain the element you’re referring to and forwarding the actions this way. But granted this questions the necessity of testing the app from a E2E scenario and would reflect the usage under unit tests better like described here