19 November, 2014

How to perform Right click on the Web element and select an option from context menu in Selenium Webdriver?

Step1: Store the path of web-element to be right clicked and web-element to be selected from context menu.
        
      WebElement rightClickelement = driver.findElement(by.---( ));  
      WebElement contextMenuelement = driver.findElement(by.---( ));  


Step2: Use Action class
          
       Actions actions = new Actions(driver);  
       Action action = actions.contextclick(rightClickelement).build( );  
       action.perform( );  


Step3: Click on the element  from the Context menu of the web element.
          
    contextMenuelement.click( );   

No comments:

Post a Comment