任何人都可以提供幫助,我試圖獲取表示智能卡按鈕的最後一個xpath元素(例如633597015500042010),然後點擊它。我試過以下方法,但仍找不到解決方案。我打算捕捉的按鈕的名稱是「選擇」。 ();}}。點擊();}}。點擊鼠標右鍵,彈出一個對話框。按鈕的最後一個元素
<html class="js flexbox flexboxlegacy canvas canvastext postmessage no-websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients no-cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache desktop" lang="en">
<head>
<body class="rwd">
<noscript> <iframe src="//www.googletagmanager.com/ns.html?id=GTM-KZFHXV" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript>
<script>
<div class="page-wrapper page-wrapper-delivery">
<div>
<div class="wrapper-wide wrapper-header" style="position: relative;">
<div class="wrapper-wide wrapper-body">
<div class="wrapper">
<div class="main">
<a id="skipnav" tabindex="-1"></a>
<div class="row hidden">
<div class="row">
<div class="row">
<div class="cf"></div>
<div class="row">
<div class="pane base12">
<form class="cf javascript-validate" novalidate="novalidate">
<div class="component checkout-page cf">
<div class="component ticket-item-base ticket-item-checkout cf">
<div class="cf">
<div class="component smart-card-checkout cf">
<div class="component vertical-accordion stag-standard-accordion checkout-accordion parent-accordion cf">
<ul id="accordion-1" class="accordion single-display">
<li class="cf open-li">
<a class="toggle-link open" href="#"> Select/request a smart card </a>
<a class="edit-link secondary-toggle-link" href="#">Edit</a>
<div class="accordion-drop" style="display: block;">
<div class="accordion-content cf">
<div class="component vertical-accordion stag-standard-accordion child-accordion cf">
<ul id="accordion-2" class="accordion multi-display">
<li class="cf open-li">
<a class="toggle-link open" href="#">Select a smart card</a>
<div class="accordion-drop" style="display: block;">
<div class="accordion-content cf">
<div class="info-box">
<form class="select-card-form" novalidate="" method="post">
<input type="hidden" value="SmartCardSelect_6822d668-9a46-4b51-910d-98c701d43fa2" name="FormName">
<input type="hidden" value="e3429d28-e838-4247-9a4e-0b3dc53cf1a7" 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="633597015500041558">
</div>
</form>
<form class="select-card-form" novalidate="" method="post">
<form class="select-card-form" novalidate="" method="post">
<form class="select-card-form" novalidate="" method="post">
<form class="select-card-form" novalidate="" method="post">
<form class="select-card-form" novalidate="" method="post">
<form class="select-card-form" novalidate="" method="post">
<input type="hidden" value="SmartCardSelect_6822d668-9a46-4b51-910d-98c701d43fa2" name="FormName">
<input type="hidden" value="94888c8a-815c-484e-808c-8d400694b9e9" name="CardId">
<div class="select-item ">
<p>Smart card 7</p>
<button class="submit-btn uniform-button button-smaller button-orange select-address" data-id="633597015500042010">
<span>Select</span>
</button>
</div>
</form>
<form class="select-card-form" novalidate="" method="post">
<form class="select-card-form" novalidate="" method="post">
<form class="select-card-form" novalidate="" method="post">
</div>
</div>
</li>
<li class="cf">
<li class="cf">
</ul>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<div class="component checkout-date-select cf no-end-date">
</div>
</div>
</div>
</div>
<div class="row">
<div class="row">
</div>
</div>
</div>`enter code here`
任何人的位置?..- :) – AzMar
一個HTML的縮進會有所幫助。該html似乎不完整,也不必發佈所有的HTML,只有主要部分與你需要的元素。試着爲你的元素標識一個獨特的父母,也可以試試這個:// span [text ()='Select']/parent :: button – lauda