Element Handling in Selenium Part 2
Element Handling in Selenium Part 2
com)
1) Handling Browser
Manual Operations:
System.setProperty("webdriver.chrome.driver", "E:/chromedriver.exe");
//Navigate Forward
driver.navigate().forward();
Manual Actions:
> Check for Displayed Status
> Check for Enabled Status
> Enter Some Value
> Return the Value
> Clear the Value
Etc...
System.setProperty("webdriver.chrome.driver", "E:/chromedriver.exe");
boolean displayedStatus =
driver.findElement(By.name("username")).isDisplayed();
System.out.println(displayedStatus);//true
boolean enabledStatus =
driver.findElement(By.name("username")).isEnabled();
System.out.println(enabledStatus);//true
driver.findElement(By.name("username")).sendKeys("abcd");
System.out.println(driver.findElement(By.name("username")).getAttribute("t
ype"));
driver.findElement(By.name("username")).clear();
driver.close();
...............................................................................
Using 2nd Syntax:
editBox.sendKeys("abcd");
System.out.println(editBox.getAttribute("type"));
editBox.clear();
driver.close();
...............................................................................
System.setProperty("webdriver.chrome.driver", "E:/chromedriver.exe");
popup.accept();
driver.findElement(By.id("login1")).sendKeys("India123");
...............................................................................
4) Handling Link