how to select table column by column header name with xpath

后端 未结 3 1085
礼貌的吻别
礼貌的吻别 2021-02-05 18:57

I have a table of results and it looks like following:

Id&
3条回答
  •  孤街浪徒
    2021-02-05 19:24

    Ok, i've found the answer that would suffice and look quite elegant. Here goes the required XPath string:

    //table/tbody/tr/td[count(//table/thead/tr/th[.="$columnName"]/preceding-sibling::th)+1]
    

    Put a name of the column instead of $columnName. This works well for me. There's no XSL or anything, just pure xpath string. How to apply it - it's another question.

提交回复
热议问题