If you really want to automate critical applications, which include advance activity like Mouse Hover, Right click, Double click, Click and Hold, Keyboard activities and so on.
You cannot automate Ajax application, which contains advance activity so let us have a look.
you can also try Drag and Drop in Selenium using Action class
You do not have to worry about all this because all will come in single bundle i.e. you can perform all this using Actions class in Selenium.
Method name and Usage
We still have so many methods in Actions class so will recommend you have a look for other methods as well here for better clarifications.
Usage of Mouse Hover- Handle Autosuggestion in Selenium
Now a days its default feature of almost all the application take an example of Google itself when you type some words on search box, it gives some related suggestion.
To achieve this we will use first mouse hover on element then click.
Scenario for Naukri.com autosuggestion
First we will enter keywords using sendKeys() method then we have to wait for some time (2 or 3 seconds) to load suggestion and once it is loaded we will use mouse hover event using moveToElement() method of action class then we will click on that particular Item using click(Webelement) method of actions class.
Let’s implement the same
Keyboard events using Actions class.
For this we will use previous example after right click we will select second option from list for this we will use ARROW_DOWN key two times then we will hit ENTER Key.
You cannot automate Ajax application, which contains advance activity so let us have a look.
you can also try Drag and Drop in Selenium using Action class
You do not have to worry about all this because all will come in single bundle i.e. you can perform all this using Actions class in Selenium.
Method name and Usage
We still have so many methods in Actions class so will recommend you have a look for other methods as well here for better clarifications.
Usage of Mouse Hover- Handle Autosuggestion in Selenium
Now a days its default feature of almost all the application take an example of Google itself when you type some words on search box, it gives some related suggestion.
To achieve this we will use first mouse hover on element then click.
First we will enter keywords using sendKeys() method then we have to wait for some time (2 or 3 seconds) to load suggestion and once it is loaded we will use mouse hover event using moveToElement() method of action class then we will click on that particular Item using click(Webelement) method of actions class.
Let’s implement the same
Right Click in Selenium Webdriver
As we discussed earlier for right-click on a particular link or any web-element Selenium Webdriver has contextClick() methods available in Actions class.
There are two flavors of this
1-contextClick()- which will right Click on a page
2-contextClick(WebElement) – which will right click on a particular web-element.
Below is the program to right click on a link in Google Home page
As we discussed earlier for right-click on a particular link or any web-element Selenium Webdriver has contextClick() methods available in Actions class.
There are two flavors of this
1-contextClick()- which will right Click on a page
2-contextClick(WebElement) – which will right click on a particular web-element.
Below is the program to right click on a link in Google Home page
Keyboard events using Actions class.
For this we will use previous example after right click we will select second option from list for this we will use ARROW_DOWN key two times then we will hit ENTER Key.