Created
August 7, 2022 15:30
-
-
Save bharathmuddada/92492a0d03d788a423033a4c0b8fe173 to your computer and use it in GitHub Desktop.
Selenium C# script examples for RIght Click and Double Click example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RightClickDoubleClick { | |
| public static void Main(string[] args) { | |
| new DriverManager().SetUpDriver(new ChromeConfig()); | |
| var driver = new ChromeDriver(); | |
| driver.Navigate().GoToUrl("https://demo.guru99.com/test/simple_context_menu.html"); | |
| driver.Manage().Window.Maximize(); | |
| var right_click_field = driver.FindElement(By.XPath("//span[@class='context-menu-one btn btn-neutral']")); | |
| var double_click_field = driver.FindElement(By.XPath("//button[contains(text(),'Double-Click')]")); | |
| Actions actions = new Actions(driver); | |
| actions.ContextClick(right_click_field).Perform(); | |
| var edit_link = driver.FindElement(By.XPath("//*[@id='authentication']/ul/li[1]")); | |
| edit_link.Click(); | |
| driver.SwitchTo().Alert().Accept(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment