We can enter a text in text box using SendKeys, but we can also do this in another ways as well.
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 = 'sunilrathore77@gmail.com';");
how i will use first method in script ....
ReplyDeleteplease give basic script example in which that method is include and can run..
good one, thanks
ReplyDeletehi
ReplyDeleteif i dont have id or name or css selector then how to resolve this issue
Hi use xpath
ReplyDelete