Html 代碼 Span 是一個按鈕 X,它出現在影像的右上角
第一頁<img src="img.jpg" class="class2">
<span> how to interact with span
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 512 512" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">
<path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 "></path></svg>
</span> how to interact with span
uj5u.com熱心網友回復:
您要查找的元素帶有svg標簽,因此常規定位器將不起作用。你需要像下面這樣嘗試,
//*[name()='svg' and @stroke='currentColor']
或者
//span//*[name()='svg' and @stroke='currentColor']
或者
//*[name()='svg' and @stroke='currentColor']//*[name()='path']
uj5u.com熱心網友回復:
如果跨度包含獨特的內容,請選擇包含該內容的跨度。例如svg:
"//span[./svg[@viewBox='0 0 512 512']]"
或者,如果您的整個代碼都被一個 div 包圍,如下所示。獲取具有正確影像的 div,然后獲取 div 內的跨度:
<div>
<img src="img.jpg" class="class2">
<span>
....
</span>
</div>
"//div[./img[src='img.jpg']]/span"
另請參閱查找子元素
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/352751.html
