0

For scrolling through a section, I wrote below code:

JavaScriptExecutor js= (JavaScriptExecutor) driver;
js.executeScript (scroll code);

but here executeSctipt method is autosuggested like:

js.executeScript(null,args) 

and it throw error as null cannot create object. The actual argument (scroll code) is working as expected in the console.

It should be displayed as:

js.executeScript(arg0,arg1);
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Sherin
  • 1
  • 1

1 Answers1

0

Using the following Eclipse version:

Version: 2022-06 (4.24.0)
Build id: 20220609-1112

The perfect suggestions are observed:

executeScript

Though selecting the suggested option defaults to null and args but the tooltip still continues to suggest the actual argument types.

executeScriptNULL

You can use the executeScript() method accordingly:

((JavascriptExecutor)driver).executeScript("return arguments[0].scrollIntoView(true)", webElement);

Refrences

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352