Friday 18 November 2011

Working with javascript popups in selenium webdriver using CSharp

driver.Navigate().GoToUrl("http://book.theautomatedtester.co.uk");
driver.FindElement(By.LinkText("Chapter1")).Click();
driver.FindElement(By.ClassName("multiplewindow")).Click();
driver.SwitchTo().Window("popupwindow"); // Here popupwindow is name of the window
string text = driver.FindElement(By.CssSelector("p[id='popuptext']")).Text;
Console.WriteLine(text);
driver.FindElement(By.CssSelector("p[id='closepopup']")).Click();
      
         

No comments:

Post a Comment