0

I'm trying to make an automatic web program using C#, Selenium, Internet Explorer 11, Visual studio 2019 and Window 10. But I encounter the following problem.

  1. When I try to access a web page and automatic login (It worked well when I use Python but C#)

    _driver.Navigate().GoToUrl("https://" + ID + ":" + PW + "@www.myWebPage.com/Index.action");

Then an exception occurred.

OpenQA.Selenium.WebDriverException: 'Failed to navigate to https://ID:PW@www.myWebPage.com/Index.action. This usually means that a call to the COM method IWebBrowser2::Navigate2() failed. The error returned is: Received error: 0x800c000e

Then I did some Googling and found another manner.

    _driver.Navigate().GoToUrl("https://www.myWebPage.com/Index.action");
var alert = _driver.SwitchTo().Alert();
alert.SetAuthenticationCredentials(sID, sPW);
_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

And then the web page was just stuck in Login popup.

Could you tell me what's wrong and how to control login popup? Thank you.

chan hong Park
  • 45
  • 2
  • 10
  • Does [this](https://stackoverflow.com/questions/62901867/failed-to-navigate-to-https-www-google-ca-this-usually-means-that-a-call-to-t/62903311#62903311) or [this](https://stackoverflow.com/questions/21451412/in-ie-org-openqa-selenium-webdriverexception-this-usually-means-that-a-call-to/62903869#62903869) discussion helps you? – undetected Selenium Sep 06 '20 at 22:26
  • In you first attempt, it looks like the URL was not correct that you had solved in the second attempt by passing the URL string directly. Try to check the HTML code of the login popup by inspecting the elements using developer tools. after switching to the popup. Try to get the elements using code and then try to set its values may help to handle the login popup properly. – Deepak-MSFT Sep 07 '20 at 03:17
  • I solve the problem by using Firefox. – chan hong Park Sep 11 '20 at 07:02
  • @DebanjanB: Thank you. I will check it sooner or later carefully. – chan hong Park Sep 11 '20 at 07:02
  • @Deepak-MSFT: I wrote different URL intentionally due to some reasons... And the login pop up isn't webpage. It's a dialog window. – chan hong Park Sep 11 '20 at 07:04
  • I understand that you had solved the issue by using the Firefox, If you want the solution for the IE browser then you can share the HTML code for that login popup. We can try to make a test with it and try to provide suggestions for it. – Deepak-MSFT Sep 11 '20 at 08:39
  • @Deepak-MSFT: Thank you for your help and interest. I found a similar case from another post. https://stackoverflow.com/questions/51191260/complete-internet-explorer-authentication-dialog-with-selenium I will try it and update the result here afterwards. – chan hong Park Sep 12 '20 at 14:04
  • You can let us know the test results. We will try to provide further suggestions, if needed. – Deepak-MSFT Sep 15 '20 at 06:15

0 Answers0