我正在尝试学习xpath.我查看了这里的其他contains()示例,但没有使用AND运算符.我不能让这个工作:
//ul[@class='featureList' and contains(li, 'Model')]
Run Code Online (Sandbox Code Playgroud)
上:
...
<ul class="featureList">
<li><b>Type:</b> Clip Fan</li><li><b>Feature:</b> Air Moved: 65 ft.
Amps: 1.1
Clip: Grips any surface up to 1.63"
Plug: 3 prong grounded plug on heavy duty model
Usage: Garage, Workshop, Dorm, Work-out room, Deck, Office & more.</li><li><b>Speed Setting:</b> 2 speeds</li><li><b>Color:</b> Black</li><li><b>Power Consumption:</b> 62 W</li><li><b>Height:</b> 14.5"</li><li><b>Width:</b> Grill Diameter: 9.5"</li><li><b>Length:</b> 11.5"</li>
<li><b>Model #: </b>CR1-0081-06</li>
<li><b>Item #: </b>N82E16896817007</li>
<li><b>Return Policy: </b></li>
</ul>
...
Run Code Online (Sandbox Code Playgroud) 我知道如何div在以下位置找到button:
//button/div[contains(text(),'Save')]
Run Code Online (Sandbox Code Playgroud)
我想知道是否可以找到任何button包含 div 且"Save"内部有文本的内容?

<button class="PinBetterSave__Button" data-test-id="PinBetterSaveButton"><div class="_w7 _0 _1 _2 _wa _36 _d _b _6">Save</div></button>
Run Code Online (Sandbox Code Playgroud) 有一个锚标记,用户可以更改其值。现在,我想编写一个 Xpath 查询,在一个语句本身中搜索多个链接文本名称。
<a href="#login" class="fancybox" xpath="1">Signin</a>
Run Code Online (Sandbox Code Playgroud)
现在,可以通过用户配置文件更改链接文本值。例如,“登录”、“登录”、“单击此处登录”或“立即登录”
如果我写 xpath:-
//a[contains(text(),'Login') or contains(text(),'Log-in') or contains(text(),'Login now') or contains(text(),'click here to Login')]
Run Code Online (Sandbox Code Playgroud)
然后它失败了。我需要使用 Selenium 单击此元素。
请帮忙。