Selenium C# example not working

Hello..

In http://toolsqa.com/selenium-webdriver/c-sharp/switch-command-in-selenium-c/, in the “New Window” section, the window pops up and is tested before rendering is complete.

You may want to consider adding a wait to the code like this:

string newWindowHandle = _driver.WindowHandles.Last();

var newWindow = _driver.SwitchTo().Window(newWindowHandle);

WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(30));

wait.Until(d => d.Title != string.Empty);
string expectedNewWindowTitle = "QA Automation Tools Tutorial";

roger

Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.