Search for element on webpage: Combine different selectors with OR

  • Is it possible to combine different selectors in one step with OR when searching for an HTML-element on a webpage? So e.g. I search with ">MATCH><svg" and want to combine this with OR to the second search expression ">MATCH><div id='signup'" if the 1st one is not found.

    So for example ">MATCH>expression1 OR >MATCH>expression2 OR >MATCH>expressionN"

    Thank you.

  • Not sure it is possible as "one-liner" command, but you can achieve
    similar functionality by using "Is element exist" action.

    So for first and second match command you need to use "Is element exist"
    action and do some actions (like click etc) if element is found.

    But you can also consider using other selectors besides MATCH, like CSS
    or XPATH selector to define unique value that is always present and not
    changeable on particular web page. Try maybe with xpath "Contains" selector,
    which can check if given phrase is contained in expressin on web page.

    Anyhow make sure to read wiki documentation regarding your case >

  • @GaG Thank you again :)

    Right, I haven't considered to use "Is element exist". I think this will do the thing I want.

    Maybe, additionally to the "IF" block in BAS, there would be also an "SWITCH" block useful to check one variable against different values in one step.

  • You can always expand BAS functionality with custom javascript or use node
    modules in your script..

Log in to reply