xml - 如何指定这个特定的 xpath
问题描述
我想替换.oe_structure
类下的内容,但我对 div 感到困惑,因为有些类名相同。我尝试从 Chrome Devtools 获取 xpath,但总是出错。
<template id="contactus" name="Contact us" page="True">
<t t-call="website.layout">
<div id="wrap">
<div class="oe_structure"/>
<div class="container">
<h1>Contact us</h1>
<div class="row">
<div class="col-md-8">
<div class="oe_structure"> <!-- How to get this path? -->
<div>
<p>Contact us about anything related to our company or services.</p>
<p>We'll do our best to get back to you as soon as possible.</p>
</div>
</div>
<div class="text-center mt64" name="mail_button">
<a t-attf-href="mailto:{{ res_company.email }}" class="btn btn-primary" id="o_contact_mail">Send us an email</a>
</div>
</div>
<div class="col-md-4 mb32">
<t t-call="website.company_description"/>
</div>
</div>
</div>
<div class="oe_structure"/>
</div>
</t>
</template>
解决方案
你也可以使用这个 xpath
//div[@class='row']//div[@class='oe_structure']
推荐阅读
- c# - 如何处理视图模型中的数字框 ValueChanged 事件?
- python-3.x - 在 pyspark 中处理多行和回车
- javascript - Angular项目-加载了错误的html文件
- statsmodels - 两个 StatsModels 模块具有完全不同的“最终运行”
- java - 如何在 Exoplayer 中编写重复模式?
- javascript - 当我尝试访问 js 文件时,Node JS 出现 404 错误
- node.js - 使用 TypeOrm 执行原始 PostgreSQL 查询时挂起
- java - a[k++] = l[i++] 表示法是什么意思
- php - 无法从 Laravel 的下拉列表中保存表列值
- c - 将内存重新分配到空引用