└── sample.java /sample.java: -------------------------------------------------------------------------------- 1 | package handlinginputs; 2 | 3 | import org.openqa.selenium.Keys; 4 | import org.openqa.selenium.chrome.ChromeDriver; 5 | 6 | public class TC001_HandlingInputs { 7 | 8 | public static void main(String[] args) { 9 | System.setProperty("webdriver.chrome.driver", 10 | "./drivers/chromedriver.exe"); 11 | ChromeDriver driver = new ChromeDriver(); 12 | driver.get("https://letcode.in/edit"); 13 | // Enter your full Name 14 | driver.findElementById("fullName").sendKeys("Koushik Chatterjee"); 15 | 16 | // Append a text and press keyboard tab 17 | driver.findElementById("join").sendKeys(" person", Keys.TAB); 18 | 19 | // What is inside the text box 20 | String myValue = driver.findElementById("getMe").getAttribute("value"); 21 | System.out.println(myValue); 22 | 23 | // Clear the text 24 | driver.findElementById("clearMe").clear(); 25 | 26 | // Confirm edit field is disabled 27 | boolean isEdit = driver.findElementById("noEdit").isEnabled(); 28 | System.out.println(isEdit); 29 | 30 | // Confirm text is readonly 31 | String isReadOnly = driver.findElementById("dontwrite").getAttribute("readonly"); 32 | System.out.println(isReadOnly); 33 | 34 | // quit browser 35 | driver.quit(); 36 | } 37 | 38 | } --------------------------------------------------------------------------------