Tuesday, 8 August 2017

Code Example - Get Atrribute

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();
}

}

}

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...