I have a long string to test and sendKeys()
takes too long. When I tried to set the value of the text
the program crashes. I know the Selenium
Extending from the correct answer of Andrey-Egorov using .executeScript()
to conclude my own question example:
inputField = driver.findElement(webdriver.By.id('gbqfq'));
driver.executeScript("arguments[0].setAttribute('value', '" + longstring +"')", inputField);
If you want to use some variable, you may use this way:
String value= "your value";
driver.execute_script("document.getElementById('q').value=' "+value+" ' ");