How To Select The Inner Elements' Text In GEB?
I have the following scenario:
- DIVs. It looks like you need to go a bit deeper, adding a
.find('span')
just before your asterisk.assert $( 'UL.select2-results LI.select2-results-dept-0.select2-result.select2-result-selectable', 0..3)*.text() == ["GBP", "KPW", "USD"]
becomes
assert $( 'UL.select2-results LI.select2-results-dept-0.select2-result.select2-result-selectable', 0..3).find('span')*.text() == ["GBP", "KPW", "USD"]
Solution 2:
I don't know why @Gabriel's answer did not work! I know there was an issue with 0..3 as it would be 0..2! But instead of find it finally worked:
assert $('UL.select2-results LI.select2-results-dept-0.select2-result.select2-result-selectable span')*.text() == ["GBP", "KPW", "USD"]
I would love to see if anyone can explain why indexing+using find+* did not work together for this particular problem or was there any logical syntax related problem.
Solution 3:
I'm thinking you might be able to simplify how you get the currencies by doing the following:
$("div.select2-result-label").children("span")*.text() == ["GBP", "KPW", "USD"]
Because you already have classes on the divs, you can easily access them using the above selector, then you can get the children span elements and get the text of each span. I hope this helps!
Post a Comment for "How To Select The Inner Elements' Text In GEB?"