Skip to content

Instantly share code, notes, and snippets.

@muditlambda
Created March 23, 2021 15:42
Show Gist options
  • Save muditlambda/7c2287ea5dcbd983eaa02e3929dd147d to your computer and use it in GitHub Desktop.
Save muditlambda/7c2287ea5dcbd983eaa02e3929dd147d to your computer and use it in GitHub Desktop.
package Pages;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class PopUp {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Shalini\\Downloads\\chromedriver\\chromedriver.exe");
//Instantiate the webdriver
WebDriver driver = new ChromeDriver();
//Set the username
String username = "admin";
//Set the password
String password = "admin";
String URL = "https://" +username +":" +password +"@"+ "the-internet.herokuapp.com/basic_auth";
driver.get(URL);
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
String title = driver.getTitle();
System.out.println("The page title is "+title);
String text = driver.findElement(By.tagName("p")).getText();
System.out.println("The test present in page is ==> "+text);
driver.close();
driver.quit();
}
}
@jeraldaj
Copy link

jeraldaj commented Jan 5, 2023

Why dont you share the Pom file as you used different dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment