Odoo XPath的一些用法示例

admin 2020-4-28 13652

取指定tag的节点:
<xpath expr="//tree" position="attributes">

取指定id的节点:
<xpath expr="//p[@id='fiscal_position_remark']" position="after">

作用未知:
<xpath expr="////field[@name='type']" position="after">
<xpath expr="////field[@name='default_code']" position="after">

取指定节点组中第几个:
<xpath expr="//page[2]" position="after">

取指定节点组中最后一个:
<xpath expr="//link[last()]" position="after">

取任意节点:
<xpath expr="." position="inside">

取指定name的节点:
<xpath expr="//field[@name='name']" position="after">

取指定属性包含特定值的节点:
<xpath expr="//t[@t-set='head']" position="inside">

非标准属性包含特定值:
<xpath expr="//div[contains(@t-attf-class, 'te_social_icon')]" position="inside">

包含特定的class:
<xpath expr="//div[hasclass('oe_button_box')]" position="inside">

取上级节点:
<xpath expr="//field[@name='order_count']/.." position="before">

取子节点:
<xpath expr="//table[@id='cart_products']/tbody/tr/td[hasclass('td-price')]/child::*" position="attributes">


最新回复 (0)
返回