Currently, I am using webdriver 2.40.0 in C# to interact with my company's website. The issue arises when I encounter a certificate error page while trying to access certain elements. Specifically, after clicking the override link and entering some information, a pop-up window appears with another certificate error page. However, when I attempt to select this pop-up window, a "noSuchWindowException" is thrown. Here is a snippet of the code:
namespace webDriverDemo
{
class Program
{
static void Main(string[] args)
{
string setURL = "xxxxx";
IWebDriver driver = new InternetExplorerDriver(@"C:\Drivers");
driver.Url = setURL;
String loginPage = driver.CurrentWindowHandle;
var securityLine = driver.FindElement(By.Id("overridelink"));
if (!securityLine.Equals(null))
{
securityLine.Click();
}
var enterBtn = driver.FindElement(By.Id("EnterButton"));
enterBtn.Click();
//Select the pop up window
driver.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()");
driver.SwitchTo().Window("xxxx");
I have attempted various solutions such as using
driver.Navigate().GoToUrl("javascript:document.getElementById('overridelink').click()")
, storing the current window handle in riskPage = driver.CurrentWindowHandle;
, and attempting to switch windows with driver.SwitchTo().Window();
. Unfortunately, it seems that identifying the window name of the certificate error page is posing a challenge and preventing me from accessing and interacting with its elements. Any assistance on resolving this issue would be greatly appreciated!