问题描述
是否可以从网页上光标的位置自动生成最具体的XPath表达式?XPath 表达式会随着onMouseMove 事件"而改变.
Is it possible to generate the most specific XPath expression automatically from the position of the cursor on the web page?The XPath expression would change with "onMouseMove event".
如果可能,您将如何实施?或者它是否已经在某些 Javascript
或 Python
库中实现?我更喜欢在 Python
中结合一些网络库,但 Javascript
也会很好并且可以接受.
If it's possible, how would you implement it? Or is it already implemented in some Javascript
or Python
library? I would prefer it in Python
with a combination of some web library but Javascript
would be good and acceptable too.
推荐答案
查看 获取 XPath DZone Snippets 中的线程,用于查找 XPath.请参阅 如何检查如果鼠标悬停在 jQuery 中的元素上? 此处的问题用于识别鼠标光标何时悬停在元素上.
See the Get XPath thread in DZone Snippets for finding the XPath. See the How do I check if the mouse is over an element in jQuery? question here for identifying when the mouse cursor is over an element.
这篇关于以编程方式创建 XPath 表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!