Search code examples
xpathhp-uft

How to build XPath with [0-9] regex expression


Hi is there anyone can help me how to build the xpath for below 2 different XPath values?

//*[@id="EditorPanel"]/div[3]/div/table[1]/tbody/tr/td/table[1]
//*[@id="EditorPanel"]/div[4]/div/table[1]/tbody/tr/td/table[1]

Im thinking something like

//*[@id="EditorPanel"]/div[3-4]/div/table[1]/tbody/tr/td/table[1]

Solution

  • div[3] is just an abbreviation of div[position() = 3], so you can use

    //*[@id="EditorPanel"]/div[position() = 3 or position() = 4]/div/table[1]/tbody/tr/td/table[1]