What does xpath=“1” mean in HTML?

浪子不回头ぞ 提交于 2021-02-08 08:52:47

问题


In my design code, the following is written. I cannot understand what xpath="1" means here.

<select class="search-category" id="ddlTemp" name="Template" xpath="1">
<option value="">Select</option>
<option value="a">a</option>
<option value="b">b</option>
</select>

回答1:


In General

There is no standard interpretation of xpath="1" in HTML because there is no standard xpath attribute on a select element (or any other HTML element). You've stumbled across some application's idiosyncratic markup; you'll have to consult the application's authors, documentation, or source code to learn the semantics of xpath="1".

Note further that the proper way to add an application or user specific attribute would have been to name it with a data- prefix: data-xpath.


Specific Application

There is an XPath utility, ChroPath, that runs as a browser extension and writes xpath (and css) attributes on elements. Credit: Randy Casburn answer to What is the significance of the attribute xpath="1" while constructing locators for Selenium tests




回答2:


XPath='1' is not the part of your HTML, it is being added through chropath plugin. You have copied this html with opened chropath tab. If you refresh the page and close the chropath tab, then you will not find xpath=1.



来源:https://stackoverflow.com/questions/65324794/what-does-xpath-1-mean-in-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!