unic / ScalaWebTest

ScalaWebTest is a library for writing ScalaTest/Selenium based integration tests for web applications. It helps you with your basic setup and provides a new and very efficient approach to testing.
https://scalawebtest.org
Apache License 2.0
29 stars 9 forks source link

`element fits gauge` fails, if element is only allowed as children of a specific element #98

Closed DaniRey closed 5 years ago

DaniRey commented 5 years ago

Some elements, like tr or td are not allowed as direct children of body. They require table as their parent.

Imagine the document is

<html><head></head><body>
<table>
 <tr><td><img src="a.jpg"></img></td></tr>
 <tr><td><img src="b.jpg"></img></td></tr>
</body></html>

Then

val row = findAll(CssSelectorQuery("table>tr"))
for(row <- rows)
 row fits <tr><td><img src="@contains .jpg"></img></td></tr>
}

Will fail, because the outerHtml of every <tr> is parsed with Jsoup, which will remove <tr> if it is not within a <table>