I have scenario to get value of Hidden field which has <p> tag in my Page using Selenium.
<p hidden="" aria-hidden="true" id='hiddenid'>127865ghbjbkjjk776876876876</p>
I have tried below code
1. String interactionid=NewVerificationModal.InteractionId.getText(); i got Blank value
2. String isChecked = (String) js.executeScript("return arguments[0].textContent", NewVerificationModal.InteractionId);, i got nullpointerException
3. String isChecked = (String) js.executeScript("return document.getElementById('hiddenInteractionId').innerHTML;");,i got Nullpointer exception
Can anyone help me how to get the value "127865ghbjbkjjk776876876876" inside P tag
sometimes, the hidden field is not completely rendered when you test it with selenium.
I made a loop to test it
You will have to replace "value" with "text" or "innerHTML".