0% found this document useful (0 votes)
61 views

Import Import Import Public Class Public Static Void Throws: "Webdriver - Chrome.driver" "./chromedriver .Exe"

Selenium_RunningNotes

Uploaded by

Amar Deo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Import Import Import Public Class Public Static Void Throws: "Webdriver - Chrome.driver" "./chromedriver .Exe"

Selenium_RunningNotes

Uploaded by

Amar Deo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

import org.openqa.selenium.

By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class MyFirstProgram {


public static void main(String[] args) throws
InterruptedException {

System.setProperty("webdriver.chrome.driver","./chromedriver
.exe"); //location of the chrome driver
WebDriver driver = new ChromeDriver(); //Opening
the browser
driver.get("https://www.demoqa.com/login");
//Navigate to google, means open google.com

driver.findElement(By.id("userName")).sendKeys("testuser");

driver.findElement(By.id("password")).sendKeys("Password@123
");
Thread.sleep(3000); //wait for 3 seconds
driver.findElement(By.id("userName")).clear();
driver.findElement(By.id("password")).clear();
driver.findElement(By.tagName("title"));

if(driver.findElement(By.id("login")).isDisplayed()) {
driver.findElement(By.id("login")).click();
System.out.println("Clicked successfully");
}
else {
System.out.println("Did not clicked!!!!");
}
driver.close();
}
}
:Important links////

https://chromedriver.chromium.org/downloads //

https://www.selenium.dev/downloads//

You might also like