Created
June 13, 2024 17:55
-
-
Save SarahElson/70311f024be441ef63d057af7bd10dda to your computer and use it in GitHub Desktop.
How To Handle Authentication PopUps in Selenium WebDriver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package CloudGrid; | |
import org.openqa.selenium.By; | |
import org.testng.annotations.Test; | |
public class TestHandlingLoginPopUpUsingCloudGrid extends BaseTest{ | |
@Test | |
public void testHandlingLoginPopUpUsingCloudGrid() | |
{ | |
String username = "admin"; | |
String password = "admin"; | |
String URL = "https://" + username + ":" + password + "@the-internet.herokuapp.com/basic_auth"; | |
driver.get(URL); | |
String title = driver.getTitle(); | |
System.out.println("The page title is : " + title); | |
String text = driver.findElement(By.tagName("p")).getText(); | |
System.out.println("The text present in page is : " + text); | |
status = "passed"; | |
System.out.println("Updated status on LambdaTest"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment