How to Send text without using sendkeys methods
public class type{
public static void setattribute(WebElement element,String attributename,String Value){
WrapsDriver wrappedElement=(WrapsDriver)element;
JavascriptExecuter driver =(JavaScriptExecutor)wrappedElement.getWrapedDriver;
driver.executeScript(arguments[0].setAttribute(arguments[1],arguments[2]",element,
attributeName,value);
}
//or
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("document.getElementById('email').value = 'thotajagan@gmail.com';");
public class type{
public static void setattribute(WebElement element,String attributename,String Value){
WrapsDriver wrappedElement=(WrapsDriver)element;
JavascriptExecuter driver =(JavaScriptExecutor)wrappedElement.getWrapedDriver;
driver.executeScript(arguments[0].setAttribute(arguments[1],arguments[2]",element,
attributeName,value);
}
//or
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("document.getElementById('email').value = 'thotajagan@gmail.com';");
Onemore Example:
driver.get("http://facebook.com/");
WebElement cssValue= driver.findElement(By.xpath(".//*[@id='s']"));
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("document.getElementById('s').value='Virender Testing
sending'");
No comments:
Post a Comment