2

Good morning, I have this simple fragment of code:

driver.Navigate().GoToUrl("https://www.mysecretwesite.com/");
            wait = new WebDriverWait(driver, TimeSpan.FromSeconds(300));
            element = wait.Until(ExpectedConditions.ElementToBeClickable(By.PartialLinkText("partial link text")));

The timespan is high because the website requires authentication. This worked fine with Firefox 52 and Selenium 3.0.1, however, after having updated to Firefox 57 and Selenium 3.8.1, the wait.until call throws an exception. Furthermore, the exception is thrown immediately, without waiting the 300 seconds as set in the wait variable. I could not find the code for the authentication form, here is how it looks like: enter image description here I am using Win 7.

parik
  • 2,313
  • 12
  • 39
  • 67

1 Answers1

0

While Automating a process it won't be a good practice to skip the Windows Basic Authentication through your Automation Script

In your code as you invoke :

driver.Navigate().GoToUrl("https://www.mysecretwesite.com/");

On reaching 'document.readyState' == "complete" the WebDriver is looking out for the PartialLinkText("partial link text") within the HTML DOM while you were trying to manually fill up the credentials through Windows Basic Authentication. So absence of the "partial link text" you see the exception

How ever, an english version of the exception you are seeing would have given us some more insight about the way to handle it.

As per best practice, we should try to handle the Windows Basic Authentication through the WebDriver only as follows :

driver.Navigate().GoToUrl("http://admin:admin@the-internet.herokuapp.com/basic_auth");

You can find some detailed discussion on Windows Basic Authentication Selenium - Other way to basic authenticate than via url and Python Selenium Alert — Prompt username and password is not working.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thank you so much for your reply, that worked. I couldn't realize how it worked with the previous version and not with the most recent one, I thought the approach would have been the same. – Andrea Filippig Dec 15 '17 at 14:05
  • I hope you don't mind if I keep this open a little more, and I hope you can help me further... The problem is that if you are already logged in with another browser/workstation, the system asks you to log out and log in again. In this case, the wait call should... wait, but it doesn't. So again the former behavior was preferred. Poorly said, I don't get why updating to 3.8.1 the wait does not work. – Andrea Filippig Dec 18 '17 at 09:11
  • @AndreaFilippig If your Application doesn't supports **`Single Sign On`** the session through which you are already logged in with another browser/workstation will be asked to log out and `Selenium` doesn't have a control over that. AFAIK, **`Selenium v3.8.1`** is much more stable wrt to the earlier releases. – undetected Selenium Dec 18 '17 at 10:21