Note- Use Javascript to send text.
syntax-
((JavascriptExecutor)driver).executeScript("document.getElementById('attribute value of id').value='text which you want to pass'");
ex-
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WithoutSendKeys {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://accounts.google.com/ServiceLogin?sacu=1&scc=1...");
((JavascriptExecutor)driver).executeScript("document.getElementById('Email').value='sanjay'");
}
}
syntax-
((JavascriptExecutor)driver).executeScript("document.getElementById('attribute value of id').value='text which you want to pass'");
ex-
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class WithoutSendKeys {
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://accounts.google.com/ServiceLogin?sacu=1&scc=1...");
((JavascriptExecutor)driver).executeScript("document.getElementById('Email').value='sanjay'");
}
}
Hi Brahma,
ReplyDeleteI have another question which i need help on, i have taken screenshots of websites using selenium web driver . I now need to write these screenshots into an excel sheet. How can i do this ?. I am already reading data from excel.
(P.S. i am not selenium/java pro, just been using it for last 4 days , have tried and learned things on the web for one of my projects)