package com.practiceCode;
import org.openqa.selenium.By;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 8-08-2017
*
*/
public class GetAttribute extends SuperTestNG {
@Test
public void getAttribute() throws InterruptedException {
try {
driver.get("file:///D:/Office/Eclipse_Projects/Project_Neon/SeleniumCodeExampleBlog/WebPage/Practice%20Form.htm");
driver.findElement(By.id("text2")).sendKeys("Gupta");
String value = driver.findElement(By.id("text2")).getAttribute("value");
System.out.println("Entered value is: " + value);
} catch (Exception e) {
e.printStackTrace();
}
}
}
import org.openqa.selenium.By;
import org.testng.annotations.Test;
/**
* @Blog Name : Selenium Code Example
* @author Deepak Gupta
* @Created Date 8-08-2017
*
*/
public class GetAttribute extends SuperTestNG {
@Test
public void getAttribute() throws InterruptedException {
try {
driver.get("file:///D:/Office/Eclipse_Projects/Project_Neon/SeleniumCodeExampleBlog/WebPage/Practice%20Form.htm");
driver.findElement(By.id("text2")).sendKeys("Gupta");
String value = driver.findElement(By.id("text2")).getAttribute("value");
System.out.println("Entered value is: " + value);
} catch (Exception e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment