java - Elements change after logging into account in Selenium -


i facing difficulty finding elements using xpath in selenium. have payment page , field enter credit card number. when write script enter credit card number using id working. problem comes when log wallet before entering cc details. after logging wallet, there 2 id's same name. script works when use absolute xpath changes when give script else.

html before before wallet

<form autocomplete="off" name="creditcard-form" method="post" action="submittransaction?mid=oivsok48659529909784&order_id=parcel675442&route=" id="card" class="cc-form validated">         <input type="hidden" name="txnmode" value="cc" />         <input type="hidden" name="txn_mode" value="cc" />         <input type="hidden" name="channelid" value="web" />         <input type="hidden" name="auth_mode" value="3d" />         <input type="hidden" name="card_type" id="cardtype" value="" />         <input type="hidden" name="walletamount" id="walletamountcc" value="0" />         <ul class="grid">             <li class="mb20 card-wrapper">                 <label class="mb10" for="cardnumber">enter credit card number</label>                 <p class="cd">                      <input autocomplete="off" type="text" name="" class="cccardnumber  text-input large-input c cardinput type-tel" id="cn" size="16" maxlength="19" style="width: 278px" data-type="cc" value="">                     <input type="hidden" name="cardnumber" value="" class="required">                 </p> 

after logging wallet:

<input type="hidden" name="txnmode" value="cc" />         <input type="hidden" name="txn_mode" value="cc" />         <input type="hidden" name="channelid" value="web" />         <input type="hidden" name="auth_mode" value="3d" />         <input type="hidden" name="card_type" id="cardtype" value="" />         <input type="hidden" name="walletamount" id="walletamountcc" value="0" />         <input type="hidden" name="addmoney" value="1" />         <ul class="grid">             <li class="mb20 card-wrapper">                 <label class="mb10" for="cardnumber">enter credit card number</label>                 <p class="cd">                      <input autocomplete="off" type="text" name="" class="cccardnumber  text-input large-input c cardinput type-tel" id="cn" size="16" maxlength="19" style="width: 278px" data-type="cc" value="">                     <input type="hidden" name="cardnumber" value="" class="required">                 </p> 

please new programming , can't figure out how handle this


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -