Working with Canvas Elements


#1

Hi,
Currently I am trying to automate games which are developed using Canvas tag.

This game has buttons like play, help etc which I want to automate.
Is there any possible way to automate these canvas elements using Katalon studio?

Sheetal


#2

sheetal sulay said:

Hi,
Currently I am trying to automate games which are developed using Canvas tag.

This game has buttons like play, help etc which I want to automate.
Is there any possible way to automate these canvas elements using Katalon studio?

Sheetal

Anyone has any idea around this?

Sheetal


#3

Not sure what is the question, but I will take a wild guess. Maybe try WebUI.switchToFrame() before working with canvas. Again, I’m not sure this will work, since I didn’t work with canvas, but hope it helps.


#4

Thank you @Mate Mrse for responding.
Let me explain the issue.

I am doing game automation. The game in included withing single canvas element. So I am doing below to automate the game:-

WebUI.switchToFrame(findTestObject(‘Page_GameLaunch/frm_Game’),500)

WebUI.waitForElementVisible(findTestObject(‘Page_GameLaunch/canvas_Game’), 50)

WebUI.clickOffset(findTestObject(‘Page_GameLaunch/canvas_Game’),649,-166)

WebUI.clickOffset(findTestObject(‘Page_GameLaunch/canvas_Game’),666,384)

This is working fine.But this solution is not feasible as we have to find out the co-ordinates every time. So my question was to look for any other solution by which we do not need to provide co-ordinates for clicking.

Regards,
Sheetal


#5

Sheetal,
I’m a step behind you on this, how can I pull the coordinates needed?
after that i’m also going to be looking for a better solution.


#6

Hi Anthony,

I used selenium recorder to get the desired co-ordinates.

Sheetal


#7

**Working with Canvas in Edge browser

**I work with canvas in my application. Chrome browser click the middle of the canvas using the action “focus” and “doubleClick”. The doubleClick/click action brings a slider window as expected in Chrome. Whereas in Edge browser, the canvas is recognised as elementPresent == true, but the doubleClick does not show the slider window. The Katalon script result shows the doubleClick action as ‘pass’ in Edge. But the slider window does not show up in the application. how to find in which coordinate, the script clicks on the canvas? Please assist. Thanks.


#8

Hi Sheetal,

Did you found any better/feasible solution for this ?

Regards,
Abhishek