Using an OR condition in Xpath to identify the same element

前端 未结 3 1366
花落未央
花落未央 2020-12-03 08:51

I have this logic which gets the current page\'s title first clicks on next button, fetches the title again and if both the titles are the same, meaning navigation has not m

相关标签:
3条回答
  • 2020-12-03 09:28

    If the element has two xpath, then you can write two xpaths like below

    xpath1 | xpath2

    Eg: //input[@name="username"] | //input[@id="wm_login-username"]

    It will choose any one xpath

    0 讨论(0)
  • 2020-12-03 09:43

    You can use or, like below:

    //tr[@class='alternateRow' or @class='itemRow']
    
    0 讨论(0)
  • 2020-12-03 09:49

    You can use or operator like

    (.//span[@class='g-title'])[2] or .//span[@class='g-title']
    

    For more details : Two conditions using OR in XPATH

    0 讨论(0)
提交回复
热议问题