Created
August 7, 2022 16:05
-
-
Save bharathmuddada/3042a5ec5eafce90243adf59ac905919 to your computer and use it in GitHub Desktop.
Selenium c# program to hover over a element
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 HoverExample { | |
public static void Main(string[] args) { | |
new DriverManager().SetUpDriver(new ChromeConfig()); | |
var driver = new ChromeDriver(); | |
driver.Navigate().GoToUrl("https://the-internet.herokuapp.com/hovers"); | |
driver.Manage().Window.Maximize(); | |
var user1_element = driver.FindElement(By.XPath("//div[@class='figure'][1]")); | |
Actions actions = new Actions(driver); | |
actions.MoveToElement(user1_element).Perform(); | |
Console.WriteLine(driver.FindElement(By.XPath("//h5")).Text); | |
driver.FindElement(By.XPath("(//div[@class='figcaption']//a)[1]")).Click(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment