OR condition in CSS selector

31,197

Update

This should do it (sorry I didn't see your edit before):

#first-order price input[type='submit'], #first price input[type='submit']

Old answer, don't use

If you are searching for IDs,

div#resultVersionA, div#resultVersionB

If you are searching for classes,

div.resultVersionA, div.resultVersionB

No need for attribute selectors. If you don't care about element type you can also omit the div parts.

Share:
31,197
user278618
Author by

user278618

Updated on August 04, 2022

Comments

  • user278618
    user278618 almost 2 years

    I'm trying to find a element by a css selector. I have a script which I'm using on multiple sites, and there is the same element, but with different classes. Is there any way to find by something like that:

    css=div[(id='resultVersionA']||[id='resultVersionB')]
    

    Best regards

    EDIT

    Your solutions works, but not for my next elements

    #first-order price, #first price input[type='submit']
    

    To be more clear: In upon query I want to select button which is under div which is i 'first_order price' OR 'first price'.