Arguments in javascript to be used with JavascriptExecutor in Selenium script









Signature of Method: Object executeScript(String script, Object... args)
The arguments to the script may be empty or any object. It can be String object, WebElement, etc..
eg:-

  •  ((JavascriptExecutor)driver).executeScript("arguments[0].click();", loginButton);  where "loginButton" is a WebElement.


  • ((JavascriptExecutor)driver).executeScript("arguments[0].value=arguments[1]",emailTextField,"qacult");    where "emailTextField" is a WebElement.

Comments

Popular posts from this blog

Robot Framework With Python: An Open Source Framework For RPA

Robot Framework in python with RIDE

How to do copy Paste in browser using selenium using Actions class