What is the difference between .// and //* in XPath?

后端 未结 4 1792
梦如初夏
梦如初夏 2020-11-22 10:39

While finding the relative XPath via Firebug : it creates like

  1. .//*[@id=\'Passwd\']--------- what if we dont use dot at the start what it sign

4条回答
  •  无人共我
    2020-11-22 11:06

    1. For the first question: It's all about the context. You can see Syntax to know what '.', '..' etc means. Also, I bet you won't find any explanation better than This Link.
    2. Simplified answer for second question: You would generally find nodes using the html tags like td, a, li, div etc. But '*' means, find any tag that match your given property. It's mostly used when you are sure about a given property but not about that tag in which the element might come with, like suppose I want a list of all elements with ID 'xyz' be it in any tag.

    Hope it helps :)

提交回复
热议问题