Select text from inner element
I want to check text from an element that is inside another element.
So I want to verify that text form div class="alert" is the correct one. But selecting this div from the validation tool does not work.
- Element locator = Use script
- text =
return document.querySelector("div.alert div span").textContent.trim();
Do we really need to include all this code, imports etc. in order to get a simple element?