- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTTP basic authentication URL with “@” in password.
We can do HTTP basic authentication URL with @ in password. We have to pass the credentials appended with the URL. The username and password must be added with the format − https://username:password@URL.
Let us make an attempt to handle the below browser authentication.
Once the User Name and Password are entered correctly and the OK button is clicked, we should be navigated to the actual page with the text Congratulations! You must have the proper credentials.
Syntax
https://username:password@URL https://admin:admin@the-internet.herokuapp.com/basic_auth
Here, the username and password value is admin.
URL is www.the-internet.herokuapp.com/basic_auth
Example
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class BrwAuthnPopup{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String a = "admin"; // appending username, password with URL String s = "https://" + a + ":" + a + "@" + "the-internet.herokuapp.com/basic_auth"; driver.get(s); // identify text String m = driver.findElement(By.cssSelector("p")).getText(); System.out.println("Text is: " + m); driver.close(); } }
Output
- Related Articles
- What are the Dynamic Password Authentication in information security?
- How To Set-Up Apache to use Password Authentication on Ubuntu 16.04
- How to plot a remote image from http url using Matplotlib?
- How to disable basic authentication for windows server using PowerShell?
- How to add http:// if it doesn't exist in the URL PHP?
- How to enable the basic authentication for windows servers using PowerShell?
- How to define the HTTP method for sending data to the action URL in HTML5?
- HTTP Requests with axios in ReactJS
- Explain secure password Encryption with PowerShell.
- Use existing authentication along with SAP BO
- Create a new user with password in MySQL 8?
- In SAP Business One, making HTTP request with SOAP body
- PHP – Detect HTTP input character encoding with mb_http_input()
- HTTP Cookies in Node.js
- Can we get the HTTP Response Code in Selenium with Java?

Advertisements