0
I have that code:
And I’m trying to retrieve the text "Test Automation".
then I made the following code.
WebElement idMenu = navegador.findElement(By.id("dropdown-menu-profile"));
String valortesteAutomacao = idMenu.getText();
assertEquals("Teste_Automacao", valortesteAutomacao);
but only appears to me:
I tried for Xphat, but it does not return....
How to do?
So I did it this way too, but the "valueAuthored" is empty. How can I do it? I tried to get the daughter DIV too, but I can’t recover the text I need. Only what’s inside her.
– Rebeca Nonato
to get all child elements you can do the following: List<Webelement> children = idMenu.findElements(By.xpath(".//*");
 if you have doubts about what your xpath is returning, you can give a Ctrl+f in the Elements tab of the Chrome developer console and test there to see what your xpath is picking up
– Lucas Miranda