TestProject Forum
Powered by leading experts in the test automation community

Fallback elements


Has anyone found a way to provide multiple selectors for an element? I’m looking to check for an element by css selector, then try a different css selector if it isn’t found as a fallback. Would be ideal if the initial selector was not found it threw a warning but didn’t fail the test? I could write a function for this, but I am wondering if there is a quick way to assign 2 selectors to a single element.

Hope that makes sense! Thanks all!

Hello @danieldjrose.
You can use recovery tests where in that recovery test you try to use a different selector instead of the original one.
Like an if-else condition where if the step fails, it will call a fallback test that tries the same action with a different selector.
You can read more on recovery tests here: https://intercom.help/testprojectio/en/articles/3788681-if-else-logic

Best Regards, Ran.

1 Like