So I found out WindowHandler if Selenium which quite userful.
Simpley here is how I make it.
C#
public static void RemoveAdd() { if (driver.WindowHandles.Count() > 1) { do { driver.SwitchTo().Window(driver.WindowHandles.Last()); driver.Close(); driver.SwitchTo().Window(driver.WindowHandles.Last()); } while (driver.WindowHandles.Count() > 1) } }
No comments:
Post a Comment