How to convert Xpath to CSS

后端 未结 4 371
长发绾君心
长发绾君心 2020-12-17 03:33

My xpath is: /html/body/div/table/tbody/tr[2]/td[4]

I need to get an CSS to use it in jsoup selector.

I found a comparison between xpath and css

4条回答
  •  有刺的猬
    2020-12-17 04:19

    While an expression like (//E)[2] can't be represented with a CSS selector, an expression like E[2] can be emulated using the :nth-of-type() pseudo-class:

    html > body > div > table > tbody > tr:nth-of-type(2) > td:nth-of-type(4)
    

提交回复
热议问题