Taiko: Automate a canvas element using taiko.

Created on 8 Mar 2019  路  10Comments  路  Source: getgauge/taiko

Is there a feature available to automate a canvas layer using taiko?

Need to perform leftclick on coordinates ( x, y ) on a canvas layer.
Click from one point to another
Click on elements on the canvas which contains a map. ( https://openlayers.org/)

Most helpful comment

All 10 comments

would it be helpful if click api can take (x,y) coordinates for your usecase ?

Not sure if I understand this right

Click from one point to another

can you please elaborate ?

"Click from one point to another" - to draw a line on canvas from one point to another using the click functions is what i meant.
@NivedhaSenthil It would be helpful if the click api had the below functionalities webdriverio-click

  • browser.leftClick(selector,xoffset,yoffset);
  • browser.moveToObject(selector,xoffset,yoffset);

  • browser.buttonUp(button);

  • browser.buttonDown(button);

leftClick can be currently achieved like await click('text',{button:left}) other mouse up, down and move are not exposed yet. And support to click on coordinates has to be added too

Thanks i will take a look at this await click('text',{button:left}) and hoping others would be added soon.

Reopening the issue to track, providing option to click using coordinates and exposing mouse actions.

Click one point to another on canvas layer can be done by following the below steps:

mouseAction('press', {x:0,y:0})
mouseAction('move', {x:9,y:9})
mouseAction('release', {x:9,y:9})

@zabil @Apoorva-GA Do we really need to define the x and y coordinates where we will release the mouse control mouseAction('release', {x:9,y:9}) ? I am asking because both move and release api are having the same x-y coordinate values. Is it possible to release the mouse control without mentioning x-y coordinates?

move and release need not have same points always, say for example if you want to draw a square action can be like below

mouseAction('press', {x:0,y:0})
mouseAction('move', {x:0,y:9})
mouseAction('move', {x:9,y:9})
mouseAction('move', {x:9,y:0})
mouseAction('move', {x:0,y:0})
mouseAction('release', {x:0,y:0})

or it can be even release at the press point even without moving to draw a point, like

mouseAction('press', {x:9,y:9})
mouseAction('release', {x:9,y:9})

move and release need not have same points always, say for example if you want to draw a square action can be like below

mouseAction('press', {x:0,y:0})
mouseAction('move', {x:0,y:9})
mouseAction('move', {x:9,y:9})
mouseAction('move', {x:9,y:0})
mouseAction('move', {x:0,y:0})
mouseAction('release', {x:0,y:0})

or it can be even release at the press point even without moving to draw a point, like

mouseAction('press', {x:9,y:9})
mouseAction('release', {x:9,y:9})

If that is the case then its better to have x-y coordinates when releasing mouse control at destination point.

This has been verified with the latest master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ariesZhou picture ariesZhou  路  5Comments

sriv picture sriv  路  5Comments

varayal picture varayal  路  9Comments

ghost picture ghost  路  6Comments

SrinivasanTarget picture SrinivasanTarget  路  5Comments