Search code examples
seleniumxpathcss-selectorsselenide

Locating element within inner injected html code


I got a web page which has other Html code within itself. The problem is Selenide/Selenium can access only outer html but can't reach the inner one. Is there any trick which let me reach inner input element?

The html code looks like this:

<!Doctype html>
<html>
...
<div>
<iframe>
#document
<!Doctype html>
<html>
<div>
<input class="text-area">
</div>
</html>
</iframe>
</div>
...
</html>

While debugging my test I always get ElementNotFound exception using those locators $x("//input") or $("input.text-area")


Solution

  • The problem was with Iframe tag on the page. I've managed to switch to it and get my elements within