Select element with *this* or *that* value

5 views
Skip to first unread message

Ben Frey

unread,
Aug 28, 2020, 2:23:14 PM8/28/20
to Geb User Mailing List

Is it possible to have a selector that can choose a given element that may have a different ID? For example, the application I'm working on has Yes/No radio buttons. Usually, Yes has an id ending in 90 and No's id ends in 91, but sometimes it's 93 and 94 instead. Rather than doing something like this, is there a way to choose whichever one is there for the No button?

no(required: false) { $('[id$="91"]') }
weirdNo(required: false) { $('[id$="94"]') }

Marcin Erdmann

unread,
Aug 28, 2020, 3:17:00 PM8/28/20
to geb-...@googlegroups.com
no { $('[id$="91"]') ?: $('[id$="94"]') }

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/9656e778-00a5-4c0f-92e2-1d45aeba0aeen%40googlegroups.com.

Ben Frey

unread,
Aug 28, 2020, 3:21:22 PM8/28/20
to Geb User Mailing List
Oh, that's brilliant.
Reply all
Reply to author
Forward
0 new messages