Webdriverio 6 - How to right click at X and Y location

1.8k views Asked by At

Webdriverio 6 - How to rightclick at X and Y location.

Could not find the rightclick command in WebdriverIO version 6 docs.

this is the code showing in WebdrivewrIO v4 but not working in V6

 browser.rightClick(elementXpath,5,184); 

Error showign is

rightClick is not a function

Is there a way to right click in WebdriverIO V6. Please help.

2

There are 2 answers

0
Mike G. On BEST ANSWER

The best option is to start with reading docs, in this case see click command usage https://webdriver.io/docs/api/element/click.html#usage

According to the docs you can pass x, y, and button.

0
JCrooks On

In API v6 you can pass the button you want to click (left||right||middle). For your use case above it would look like the following.

$(selector).click({ "right", 5, 184 })

Their v6 API docs can be found here: https://v6.webdriver.io/docs/api.html