0
我需要在下面的HTML代碼中獲取data-id
的值。獲取元素的值
我試圖代碼:如下圖所示
//p[contains(.,'Smart card')]/following-sibling::button[@data-id='633597015500043521']"));
我的HTML代碼:
<form class="select-card-form" novalidate="" method="post">
<input type="hidden" value="SmartCardSelect_3ca61d51-e601-40de-80fd-308bc47b52c6" name="FormName">
<input type="hidden" value="d79cf158-93ad-4c77-b4bc-516ce8b28302" name="CardId">
<div class="select-item ">
<p>Smart card 1</p>
<button class="submit-btn uniform-button button-smaller button-orange select-address" data-id="633597015500043521">
<span>Select</span>
</button>
</div>
</form>
編程語言? – Andersson
[在webdriver中如何獲取div中的屬性值]可能的副本(http://stackoverflow.com/questions/17592786/how-to-get-attribute-value-inside-a-div-in-webdriver) – JeffC
請在發佈之前通過HTML美化工具運行您發佈的HTML,如http://www.cleancss.com/html-beautify/。它會使閱讀更容易。 – JeffC