Right Click in Selenium WebDriver
ContextClick()
By using Context Click Method We Right Click In selenium
Syntax-
WebElement Rclick =driver.findElement(By.name("email"));
Actions act = new Actions(driver);
act.contextClick(Rclick).perform();
Selenium Code For Right Click
package automationtesting;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class Rightclick {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","D:\\Sandeep\\Soft\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
WebElement Rclick =driver.findElement(By.name("email"));
Actions act = new Actions(driver);
act.contextClick(Rclick).perform();
}
nice post.
ReplyDeleteselenium online trainings
selenium trainings