Set value of input instead of sendKeys() - Selenium WebDriver nodejs

后端 未结 8 1951
死守一世寂寞
死守一世寂寞 2020-11-30 03:53

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

8条回答
  •  萌比男神i
    2020-11-30 04:18

    In a nutshell, this is the code which works for me :)

    WebDriver driver;
    WebElement element;
    String value;
    
    JavascriptExecutor jse = (JavascriptExecutor)driver;
    jse.executeScript("arguments[0].value='"+ value +"';", element);
    

提交回复
热议问题