Selenium with Java 46 - How to Handle basic Authentication window

Publicado el: 30 julio 2018
en el canal de: Ankpro Training
3,231
16

How to Handle basic Authentication window?
Like our facebook page www.facebook.com/ankprotraining
Handling Basic Authentication Window in selenium webdriver:
This is a Basic authentication window used to accept the username and password with browser alert popup
We will get this popup when we try access a server resource which requires authentication
This popup appears the moment we enter the url in the address bar

Methods of handling authentication window in selenium webdriver :
We can handle basic authentication in 4 ways
1. Passing user name and password along with the url
driver.get(“http://UserName:Password@ankpro.com”)
2. alert.setAuthenticationCredentials method.
driver.switchTo().alert().setAuthenticationCredentials(“username”,”password”)
3. Using SendKeys
alert.sendKeys( "username" + Keys.Tab + "password" + Keys.Tab); alert.accept();
4. We can use the third party automation tools like AutoIt or Sikuli for sending the keys to this window.

The approach to handle authentication window popup may be different in each browser, try any one of mentioned method.
In case your authentication server requires username with domain like "domainuser" you need to add double slash  to the url:
//domainname\user:password@example.com
If your username or password is having @ symbol then replace it with %40

Possible Interview Questions on selenium webdriver on handling basic authentication window:
How to handle basic authentication windows?


En esta página del sitio puede ver el video en línea Selenium with Java 46 - How to Handle basic Authentication window de Duración hora minuto segunda en buena calidad , que subió el usuario Ankpro Training 30 julio 2018, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 3,231 veces y le gustó 16 a los espectadores. Disfruta viendo!