you for your response Plamen. I loaded up your example, but unfortunately, this
does not help me.
I already understand how
to set up a WaitForElement condition codelessly; but doing it codelessly is very
clunky to set up, and results in having the empty else branch that will never
execute, as well as an extra waitforelement statement that also never executes (see screenshot). I find to be dismaying that If I have 5 codeless conditionals
it will result in 10 lines of needless clutter, including several empty ‘else’ branches.
am shocked to learn this is a design decision, and I won’t comment as to what I
think of that. But as it is the case, I would like to perform conditionals in
code when possible, which leads me to my next question:
cannot use in code:
Perform validation on element
Waitforelement is a void
method, and the ‘if statement’ takes a Boolean so this will not work.
would like to know these things specifically.
1. How should I set up the above conditional?
2. How do I tell a coded step that it is supposed to record a ‘failure’
vs to ‘’ignore’ (move on without recording a failure?)
one of the fields I am working on, depending on what is selected, an extra box
may pop up. I want to check if the extra box popped up, and if it did, I want
to enter a value in it. But if I use a validation to check for it and it is
not there, the step may record a failure when I don’t want it to.
could be based off the value of the previous box to know whether the new box is
supposed to be there and check for it, but for the sake of this question
pretend I must check if the new box exists without knowing that.)
restate: How do I prevent the coded step from ‘failing’ in the first place as
opposed to ‘continuing on failure’.
3. How do I use separate validations within a single coded step.
Forinstance, if I have a coded step, and I want to check, within this single
coded step, the following conditions:
* if the inner text of textbox1 is more than 20 characters, I want the step to fail with the message “Failure: More than 20 characters”.
* if the inner text of textbox1 has the letter ‘A’, I want the step to fail with the message “Failure: Contains the letter ‘A’”.
* if the inner text of textbox1 has numbers, I want the step to fail with the message “Failure: Contains Numbers”