I am trying to access specific a <tr>
element in an HTML Code.
The part of the code where the element is defined is shown as follows
<tr class='oddRow cellCont' OAArgs="OLMMV0-Walarus-Data-Maladie','" id='$PpyWorkPage$pPathologies$l1' data-test-id='202004251224080892667-R1' PL_INDEX = '1' >
.
After the second line of the code below, I tried to declare the expressions tableRow.className()
and tableRow.attr("class")
which both returned "oddRow cellCont" of the type java.lang.String
But, I tried the following snipet which does not work since the condition in the loop returns false. I also tried the if condition using tableRow.attr("class")
and oddRow
, cellCont
, oddRow
, ... in all possible combinations.
I am definetely stuck; I need help please.
Elements tableRows = field.getElementsByTag("tr");
for (Element tableRow : tableRows) {
if (tableRow.className() == "oddRow cellCont")```