Quality Testing

Quality is delighting customers

How to simulate the right click operation in WebDriver?

How to simulate the right click operation in WebDriver?

Views: 132

Reply to This

Replies to This Discussion

if you know programming: 
Use the actions object in selenium
to simulate mouse clicks
Actions
selAction = new Actions(driver);
selAction.moveToElement(Webelement);
selAction.contextClick(Webelement).build().perform();
/* this will perform right click */

good luck
Ralph
owner bsure-digital




Thanks Ralph

Hi,

Use following code. Further you can check automated testing services for any details on automation services,

public void rightClickOperation(WebElement webElement){

// Initialize Actions class object
Actions builder = new Actions(driver);

// Perform Right Click on target element.
builder.contextClick(webElement).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).perform();
//ContextClick() is a method to use right click


//closing current driver window
driver.close();
*/
}

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

¬© 2018   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service