I am using Selenium and java, after clicking on one button I land on another page and I see the input tag that I am looking in the viewport
after waiting for page to load with
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
in order to get the tag I use the scrollIntoView() and search for the element by id using javascript inside java this way:
js.executeScript("document.getElementById('elementId').scrollIntoView(true);");
but the problem is that document.getElementById('elementId') returns null; I tried it also in the firefox webdriver console with the same result.
If I execute document.getElementById('elementId')
on the same page using firefox console but without using Selenium webdriver I get the tag as expected.
Why am I getting this null using Selenium? How to fix it?