Actions Class:
Actions class is used for handling mouse and keyboard events in Selenium
Mouse Actions:
doubleClick(): Performs double click on the element
clickAndHold(): Performs long click on the element without releasing it
dragAndDrop(): Drags the element from one point and drops to another
moveToElement(): Shifts the mouse pointer to center of element
contextClick(): Performs right click on the element
Handling Alerts:
Alert is a small message box which displays on screen notification
Alert Types:
Simple Alert - Used to display some information to user and only contains an Ok button
Prompt Alert - Used to get some input from the user
Confirmation Alert - It comes with an option to accept or dismiss the alert
Methods:
dismiss(): To click on the Cancel button of the alert
accept(): To click on the Ok button of the alert
getText(): To capture the alert message
sendKeys(): To send some sequence of characters to alert box
Keyboard Actions:
sendKeys(): Sends a series of keys to the element
keyUp(): Performs key release
keyDown(): Performs key press without release
Handling Multiple Windows:
Multiple windows can be handled by Windows Handlers in Selenium.
getWindowHandle() - Returns the current window handle
getWindowHandles() - Returns the set of all handles for all the opened windows
switchTo().window() - Switch to another window using the window handle
Handling Cookies:
A cookie is a small piece of data that is sent from a website and stored in your computer. Cookies are mostly used to recognize the user and load the stored information.
getCookies()- Returns the list of all cookies
getCookieNamed()- Return specific cookie according to name
addCookie()- Create and add the cookie
deleteCookie()- Delete specific cookie
deleteCookieNamed()- Delete specific cookie according to name
deleteAllCookies()- Delete all cookies