tal icon indicating copy to clipboard operation
tal copied to clipboard

Testing TAL - click() on elements

Open dkondraszuk opened this issue 4 years ago • 2 comments

Hi guys, I'm writing automated UI tests using selenium. I've encountered an issue when tried to click() on an element - seems like it does not work.

Is there any way to select/click on elements using JS?

Thanks!

dkondraszuk avatar Jun 09 '20 14:06 dkondraszuk

Hi @dkondraszuk,

TAL doesn't handle mouse events (including click), only key press events.

Looking at a Puppeteer example, we use page.keyboard.press to navigate and select with our Chrome device config. This works because our key mappings - https://github.com/bbc/tal/blob/master/config/devices/chrome-20_0-default.json#L57 - map Chromium's directional and enter key presses to the relevant TAL virtual key events.

An alternative would be firing virtual TAL events directly e.g.:

 var KeyEvent = require('antie/events/keyevent');
 var Application = require('antie/application');
 var application = Application.getCurrentApplication();
 application.bubbleEvent(new KeyEvent('keydown', KeyEvent.VK_ENTER));
 application.bubbleEvent(new KeyEvent('keyup', KeyEvent.VK_ENTER));

See the implementation - https://github.com/bbc/tal/blob/master/static/script/devices/browserdevice.js#L307 - if you want to understand more.

tsadler1988 avatar Jun 12 '20 10:06 tsadler1988

wow people still use this!

quantuminformation avatar Jun 12 '20 10:06 quantuminformation

We have deprecated this project and there are no plans for active development going forward.

Please see the deprecation notice.

kukulaka avatar Jan 04 '23 09:01 kukulaka