Created
March 23, 2021 15:42
-
-
Save muditlambda/7c2287ea5dcbd983eaa02e3929dd147d to your computer and use it in GitHub Desktop.
This file contains 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 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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why dont you share the Pom file as you used different dependencies