regex - How to handle dynamically changing id's with similar starting name using Webdriver -


i automating test web application. have scenario creating admin, have enter name, email address , phone number text boxes. ids of text boxes dynamic.

username, id='oe-field-input-41' email, id='oe-field-input-42' phone number, id='oe-field-input-43' 

first query: numbers in ids dynamic, keep changes tired use xpath handling dynamic value.

xpath = //*[starts-with(@id,'oe-field-input-')] 

in enter text first text box successfully

second query: not able use same xpath next 2 text boxes, enters email , phone number name field only

please me resolve dynamic value handling.

edited: added html code,

<table class="oe_form_group " cellspacing="0" cellpadding="0" border="0">  <tbody>   <tr class="oe_form_group_row">    <td class="oe_form_group_cell oe_form_group_cell_label" width="1%" colspan="1">     <td class="oe_form_group_cell" width="99%" colspan="1">     <span class="oe_form_field oe_form_field_many2one oe_form_field_with_button">      <a class="oe_m2o_cm_button oe_e" tabindex="-1" href="#" draggable="false" style="display: inline;">/</a>      <div>     </span>    </td>   </tr>   <tr class="oe_form_group_row">    <td class="oe_form_group_cell oe_form_group_cell_label" width="1%" colspan="1">     <td class="oe_form_group_cell" width="99%" colspan="1">     <span class="oe_form_field oe_form_field_email">      <div>      <input id="oe-field-input-35" type="text" maxlength="240">      </div>     </span>    </td>   </tr>   <tr class="oe_form_group_row">    <td class="oe_form_group_cell oe_form_group_cell_label" width="1%" colspan="1">     <td class="oe_form_group_cell" width="99%" colspan="1">     <span class="oe_form_field oe_form_field_char">      <input id="oe-field-input-36" type="text" maxlength="32">     </span>    </td>   </tr>   <tr class="oe_form_group_row">    <td class="oe_form_group_cell oe_form_group_cell_label" width="1%" colspan="1">     <td class="oe_form_group_cell" width="99%" colspan="1">     <span class="oe_form_field oe_form_field_char">      <input id="oe-field-input-37" type="text" maxlength="32">     </span>    </td>   </tr>   <tr class="oe_form_group_row">  </tbody> 

you can try alternate way locating unique element label or so. example:

  • css=.oe_form_group_row:contains(case_sensitive_text) input
  • xpath=//tr[@class = 'oe_form_group_row'][contains(.,'case_sensitive_text')]//input

if using isfw should create custom component such form fields.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -