我想單擊對話框中的確定按鈕。我如何找到xpath來查找按鈕並單擊關閉窗口。它不在任何Iframe中。 這裏是我的代碼:如何處理對話框窗口點擊硒webdriver中的按鈕
`<div id="YesNoDialogBox" class="dialogbox errorDialog firepath-
matching-node" style="display: block;">
<div class="errWarnMsg">
<div class="popupHeaderContainer">
<div class="imgicon"><img src="/web/images/error.png" class="vMiddle"
tabindex=""></div>
\t <h1>Warning message</h1>
\t <!-- Start: Warehouse change confirmation popup --><a href="#" id="close" class="closeClass warehouseCancel" tabindex="">
\t <img src="/web/images/close.png" class="closeIcon errWarnIcoClose" tabindex="">
\t </a>
\t <div class="clear"></div> \t
\t <div class="msgBody paddingTopBtm2 textLeft padLeft10 warehouseText" style="">
\t \t \t \t <span class="warningText" id="errorTextWarning">
\t \t \t \t Please Confirm to change warehouse
\t \t \t \t <br><br>
\t \t \t \t \t Do you want to continue?
\t \t \t \t </span>
\t </div>
\t <div class="msgBody paddingTopBtm2 textLeft padLeft10 customerText" style="display:none">
\t \t <span class="warningText" id="errorTextWarning">
\t \t \t Please Confirm to change Customer
\t \t \t <br><br>
\t \t \t \t Do you want to continue?
\t \t </span> \t \t
\t </div>
\t <div id="dialogboxNav" class="padding10 textLeft padLeft10 marginleft40">
\t \t <button class="enterSubmit btnInactive" name="btn_delete" id="warehouseOk" tabindex="">Yes</button>
\t \t
\t \t <a href="javascript:;" id="cancelDialog" class="formblue_link closeClass warehouseCancel" tabindex="">No</a>
\t </div>
</div>
</div>
</div>`<div id="YesNoDialogBox" class="dialogbox errorDialog firepath-
matching-node" style="display: block;">
<div class="errWarnMsg">
<div class="popupHeaderContainer">
<div class="imgicon"><img src="/web/images/error.png" class="vMiddle" tabindex=""></div>
\t \t <h1>Warning message</h1>
\t \t <!-- Start: Warehouse change confirmation popup --><a href="#" id="close" class="closeClass warehouseCancel" tabindex="">
\t \t <img src="/web/images/close.png" class="closeIcon errWarnIcoClose" tabindex="">
\t \t </a>
\t \t <div class="clear"></div> \t
\t \t <div class="msgBody paddingTopBtm2 textLeft padLeft10 warehouseText" style="">
\t \t \t \t \t <span class="warningText" id="errorTextWarning">
\t \t \t \t \t Please Confirm to change warehouse
\t \t \t \t \t <br><br>
\t \t \t \t \t Do you want to continue?
\t \t \t \t \t </span>
\t \t </div>
\t \t <div class="msgBody paddingTopBtm2 textLeft padLeft10 customerText" style="display:none">
\t \t \t <span class="warningText" id="errorTextWarning">
\t \t \t \t Please Confirm to change Customer
\t \t \t \t <br><br>
\t \t \t \t Do you want to continue?
\t \t \t </span> \t \t
\t \t </div>
\t \t <div id="dialogboxNav" class="padding10 textLeft padLeft10 marginleft40">
\t \t \t <button class="enterSubmit btnInactive" name="btn_delete" id="warehouseOk" tabindex="">Yes</button>
\t \t
\t \t <a href="javascript:;" id="cancelDialog" class="formblue_link closeClass warehouseCancel" tabindex="">No</a>
\t \t </div>
</div>
</div>
</div>
在提供的HTML中有多個yes/no按鈕,您要查找哪一個按鈕? –