Exception thrown when ensuring an XPathOrCssTarget has some value #3350
Unanswered
MaxenceBontePE
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a plain XPathOrCssTarget
public static final Target LIBELLE_COMPETENCE_NUMERO = XPathOrCssTarget .the("libellé de la compétence numéro {0}") .locatedBy("#competence-clef li:nth-child({0}) .media-body > span > span");
then I use it (in a loop) to remember values
for (int i =0 ; i < CandidatForm.LIBELLE_COMPETENCE.resolveAllFor(actor).size() ; i++) { actor.remember("compétence" + i, CandidatForm.LIBELLE_COMPETENCE_NUMERO.of(String.valueOf(i+1))); }
and then I ensure the same field later has the same value as stored
for (int i =0 ; i < CandidatForm.LIBELLE_COMPETENCE.resolveAllFor(actor).size() ; i++) { Ensure.that(CandidatForm.LIBELLE_COMPETENCE_NUMERO.of(String.valueOf(i+1))) .hasValue(actor.recall("compétence" + i));
but I get the following exception
[ERROR] class net.serenitybdd.screenplay.targets.XPathOrCssTarget cannot be cast to class java.lang.String (net.serenitybdd.screenplay.targets.XPathOrCssTarget is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
Did I get something wrong or is this a bug ?
I have penty of Ensures on plain Targets (Target.the("").located(By.something("somethingelse")) having values and recalls and it works fine.
Beta Was this translation helpful? Give feedback.
All reactions