'How do I locate elements inside a canvas for robotframework automation testing?

I'm using robotframework and python to write automation test cases. But for Tableau graph, it is inside a canvas tag. I want to click some elements (dynamic) in the graph but I cant find the locator of the elements. I know coordinates works but it is just not practical in this case as the element position isn't fixed. Is there any way I can find the locator of the elements or any other way I can automate the click of the elements inside a tableau table or a canvas?



Solution 1:[1]

First of all, i see it's inside an iframe. When there is an iframe present and you want to interact with an element inside of it, you need to select that iframe. So make sure you select the iframe using: Select Frame

To select a canvas in this case try to look to the upper levels. Here is a xpath for a random canvas on the tableau example u send:

(//div[@id='view6637812712846354816_280773651190758291']//div//div)[2]//canvas

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 etoprak