I am using WatIn. I need to get the OuterHtml from the new window that opens when I click on the link.
I tried to find the new popup but i think it's working only from the popup in the same window, but I'm getting a new window.
How can i found the new window that my link opens?
using (IE browser = new IE("https://login.com"))
{
try
{
if (linkExist) browser.Image(Find.ById("inputSend")).Click();
browser.WaitForComplete();
linkExist = false;
//This not working
var poppedUpBrowser = IE.AttachTo<IE>(Find.ByUrl("https://login.123.com"));
}
catch (Exception ex)
{
successful = false;
}
}
If you are trying to get a new window by clicking a link, then use ClickNoWait method for the link. Since Click triggers a wait for call to finish, which will internally checks for the browser state and might throw exception. Please use the below code and check.
using (IE browser = new IE("https://login.com"))
{
try
{
if (linkExist) browser.Image(Find.ById("inputSend")).ClickNoWait();
linkExist = false;
IE poppedUpBrowser = IE.AttachTo<IE>(Find.ByUrl(url => url.Contains("https://login.123.com")));
}
catch (Exception ex)
{
successful = false;
}
}
Make sure the targeted URL string is proper in the Attach TO method.