我正在用python PAMIE模块做一些脚本。
在我的脚本中,我使用internet explorer对象来处理这个对象。
我正在使用DOM路径,但它不容易检查完整的dom元素路径。
例如,我如何搜索像这样的完整dom路径?
divChild.nextSibling.nextSibling.nextSibling.nextSibling.childNodes[0].nextSibling.nextSibling.nextSibling.nextSibling.childNodes[0].childNodes[0].childNodes[0].childNodes[0]手工检查并不容易
如果有人能帮我的忙,请多多指教!
发布于 2010-11-01 21:05:06
你能通过对象id来识别节点吗?
document.getElementById("elementId")发布于 2015-02-10 07:58:04
尝试使用这个:https://github.com/asatour/jquery-domPath。获取HTML jquery元素的DOM路径
<body>
<div class="module" id="products-block">
<div class="description">
<h1 class="section-title">
product general description
</h1>
<ul class="products">
<li>Cameras</li>
<li>TV</li>
<li>Computers</li>
</ul>
</div>
</div>
</body>JavaScript:
var products_domPath = $(".products").domPath();输出:
["div#products-block.module > div.description > ul.products"]https://stackoverflow.com/questions/4069036
复制相似问题