Return to site

Right click hold test

broken image
broken image

But this method does not deal with a particular web element. In the previous section, we have seen clickAndHold() method of actions class which will click and hold a WebElement at current position of the cursor. How to Perform Click and Hold WebElement Action in Selenium WebDriver Now execute this in your eclipse and see what happens.

broken image

When we will move the cursor to the location of title B then title B has been shifted to location of title C. In this example program, first, we move cursor to the location of title C and then click and hold title C. The title movement will be similar to the below screenshot as shown below. Move the cursor to the position of element C.Īctions.moveToElement(titleC) // Call clickAndHold() method to perform click and hold operation. Create an object of actions class and pass reference of WebDriver as a parameter to its constructor.

broken image

WebElement titleC = driver.findElement(By.xpath('//li')) Program source code 1: package clickAndHoldAction Let’s create a test case where we will automate the following scenario.