Locating elements on Canvas by selenium webdriver

Hi, i am using protractor-jasmine to automate angularJS application. Is there a way of identifying or to perform operations on Canvas element by selenium webdriver?

I can only find Canvas as a single element in DOM, and not able to locate any tables or joins at canvas with firebug. Is there a way i can automate and locate elements(tables, joins) on Canvas?

Code for canvas:
<span role=“treeitem” ="nodeLabel repTarget "><<span ="nodeTag ">canvas<span ="nodeAttr editGroup "> <span ="nodeName editable “>style=”<span ="nodue editable “>position: absolute; top: 0px; left: 0px; z-index: 2; -moz-user-select: none; width: 819px; height: 398px; cursor: auto;”<span ="nodeAttr editGroup "> <span ="nodeName editable “>width=”<span ="nodue editable “>819”<span ="nodeAttr editGroup "> <span ="nodeName editable “>height=”<span ="nodue editable “>398”<span ="nodeAttr editGroup "> <span ="nodeName editable “>tabindex=”<span ="nodue editable “>0”<span ="nodeBracket editable insertBefore ">><span ="nodeText editable “><span =” ">This text is displayed if your browser does not support the Canvas HTML element.</<span ="nodeTag ">canvas>

You really should not be manipulating a Canvas element within the Div element that hosts the Diagram. In the future there might be more than one Canvas, or perhaps none at all.

By “elements(tables, joins)” are you referring to GoJS Nodes? If so, you can use the properties and methods of the Diagram class to find what Nodes and Links there are and which ones might be visible in the viewport.

By the way, have you seen the Robot class in the Extensions directory? It is used by this sample: http://gojs.net/latest/extensions/Robot.html

Hi, thanks for the reply walter. Can you please provide a sample code by which i can access Canvas properties i.e nodes and links information inside canvas using selenium webdriver command or protractor method? It would be really helpful for me to understand this.

Thanks in advance.

If you search for “selenium” you will find:

@tusharkumar - Did you find any solution for this.