Created
August 10, 2022 01:39
-
-
Save bharathmuddada/773aca32f10bd14ad6360599f66ed463 to your computer and use it in GitHub Desktop.
C# Selenium code to handle frames
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 SeleniumFrameHandling { | |
public static void Main(string[] args) | |
{ | |
new DriverManager().SetUpDriver(new ChromeConfig()); | |
var driver = new ChromeDriver(); | |
driver.Manage().Window.Maximize(); | |
driver.Navigate().GoToUrl("https://the-internet.herokuapp.com/tinymce"); | |
driver.SwitchTo().Frame("mce_0_ifr"); | |
var contentfield = driver.FindElement(By.XPath("//*[@id='tinymce']/p")); | |
contentfield.Clear(); | |
contentfield.SendKeys("test automation"); | |
driver.SwitchTo().DefaultContent(); | |
Console.WriteLine(driver.FindElement(By.TagName("h3")).Text); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment