I'm trying to verify a few things on a page and have a grid with header columns. I want to grab the text from those are part of the verification. For some reason it's returning empty and I don't understand why considering I'm using contains text to find the element.
String expectedName = "Employee Name";
String actualName = driver.findElement(By.xpath("//div[contains(text(), 'Employee Name')]")).getText();
Assert.assertEquals(expectedName, actualName);
The error I get is this: java.lang.AssertionError: expected [Employee Name] but found []
The HTML:
<div class="dx-datagrid-text-content dx-text-content-alignment-left dx-header-filter-indicator" role="presentation">Employee Name</div>