xpath ="1"代表什么?在HTML中意味着什么? [英] What does xpath="1" mean in HTML?

查看:77
本文介绍了xpath ="1"代表什么?在HTML中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的设计代码中,写了以下内容.我不明白 xpath ="1" 在这里的含义.

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>

推荐答案

常规

HTML中没有对 xpath ="1" 的标准解释,因为 select 元素上没有标准的 xpath 属性(或任何其他HTML元素).您偶然发现了某些应用程序的特有标记;您必须查阅应用程序的作者,文档或源代码,以了解 xpath ="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".

请进一步注意,添加应用程序或用户特定属性的正确方法是使用 data-前缀: data-xpath 对其进行命名.

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.

有一个XPath实用程序 ChroPath ,它可以作为浏览器扩展程序运行,并编写 xpath元素上的(和 css )属性.信用: Randy Casburn回答

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

这篇关于xpath ="1"代表什么?在HTML中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆