I have an html tag which is not visible on screen (isDisplayed returns false) but i want to get the value of it. For eg:
<div class="qgwy">Gift No.3726</div>
I want to extract the value "Gift No.3726". I tried this code and it prints nothing:
WebElement gwy = driver.findElement(By.cssSelector(".qgwy"));
System.out.println(gwy.getText());
After careful comparisons, I realized that, the getText() method only works for elements' tag which are visible (or not hidden) on screen. So, I was wondering if it's possible to extract that data without asking my developers to modify the code.