XPath query to select all href attributes of tag, which 'class' attribute equals specified string

后端 未结 4 1199
时光取名叫无心
时光取名叫无心 2020-12-30 00:20

I don\'t know why following query doesn\'t work:

//a/@href[@class=\'specified_string\']
4条回答
  •  猫巷女王i
    2020-12-30 00:28

    You basically say that you are looking for an attribute named href, whose attribute (this is the error) class should be equal to specified_string.

    But you need to find the attribute href of an element a, whose attribute class is specified_string.

    (ndim's answer overlapped mine)

提交回复
热议问题