Reply To: test.selected() for multiple options

PennController for IBEX Forums Support test.selected() for multiple options Reply To: test.selected() for multiple options

#6164
daniela
Participant

Hi Jeremy,

worked like a charm, thanks!

For anybody who finds this post and wants to see how I implemented Jeremy’s response, here’s my code:

newButton("consent", "Continue")
               .settings.center()
               .print()
               .wait(getDropDown("age")
                     .testNot.selected("17 or younger")
                     .and( getDropDown("age")
                           .testNot.selected("32 or older") 
                         )
                     .and(getDropDown("language") 
                          .test.selected("no")
                          )
                     .success() // if '17 or younger' or '32 or older' are NOT selected, and 'no' IS selected, continue as normal
                     .failure(  // otherwise, remove all canvases and display the "bye" text
                         getCanvas("democanvas")
                         .remove()
                         ,
                         getCanvas("agecanvas")
                         .remove()
                         ,
                         getCanvas("sexcanvas")
                         .remove()
                         ,
                         getCanvas("languagecanvas")
                         .remove()
                         ,
                         getCanvas("infocanvastwo")
                         .remove()
                         ,
                         getCanvas("infocanvasthree")
                         .remove()
                         ,
                         getText("consent")
                         .remove()
                         ,
                         getButton("consent")
                         .remove()
                         ,
                         newText("bye", "You are ineligible for this study, as you have provided information which is inconsistent with your Prolific prescreening responses. "
                                 + "<p>Please return your submission on Prolific by selecting the 'Stop without completing' button."
                                ) .print() 
                     )
                    )

Thanks, Jeremy!

Best,
Daniela