Hi,
I am posting to a website that needs to open a new tab to continue, which works fine. After the new tab is opened, I continue with
var newWindow = browser.FindWindow("New Tab");
and everything works well. The issue comes at the end of my code where the new tab comes back to its first page (still 2 tabs open) and I need to extract some html from it. For some reason "newWindow" is not recognizing the second tab anymore, but completely focuses on the first. Here's the code:
newWindow.FindId("Next").Click(); --> Works. Focuses on 2nd tab.
if (newWindow.HasContent("The following errors occurred:", new Options { Timeout = TimeSpan.FromSeconds(10) })) ---> Works well. Focuses on 2nd tab.
{
//Grab error statements from website
var html = newWindow.ExecuteScript("return document.getElementsByTagName('ul')[0].innerHTML"); ---> Goes crazy. Somehow focuses on 1st tab.
I am certain that it is the newWindow object that is switching due to testing. I even tried restating the first statement to re-assign the newWindow object to the 2nd tab but it was still focused on the 1st. Any idea what's going on?
Thanks.