While running a script in the console of the browser on the aforementioned page, I encountered the following:
document.querySelector('.subscribe_form input').value
The placeholder value displayed was "Enter your email address."
However, when attempting to execute this in Java by navigating to the page and using the following code:
JavascriptExecutor js = (JavascriptExecutor)driver;
String emailPlaceholder = String.valueOf(js.executeScript("document.querySelector('.subscribe_form input').value"));
I consistently receive 'null' or NullPointerException as the outcome, even if I try .toString() or casting to (String).
Do you have any insights into what might be going wrong? Or why this script is not functioning as expected in Java with Selenium?