Highlighted
Absent Member.
Absent Member.
587 views

Dynamic Object Identification

Hi All, 

 

I am using UFT12, I have an issue when I am identifying web objects which have a dynamic HTML ID, I tried with the regex but It doesn't work correctly, I tried to remove the name property and it doesn't work too, I am thinking about identifying the parent of the object for example I have a WebEdit as an object and Webtable is its parent and then I use then childitem(row,column,object class,index) function to get the object but this function is identifying  the object uniquely using the index which may be dynamicly changed if I  add new objects to my screen, any help please ? 

0 Likes
4 Replies
Highlighted
Frequent Contributor.. Frequent Contributor..
Frequent Contributor..

Regular Expression should be the easiest and best way in such scenario. Can you detail the pattern you get and what you have tried?

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Saket,

First thnk your for replying, I have a  Static pop-up where the html ids of the fields contains numbers, I observed that these html ids with numbers keep changing environment wise. I need to make it constant, Since, if there is any change in the html id I need to update the object repository for the environment and need to maintain object repository environment wise.

I am trying to use the regular expression to get only the field name, but however it is not working. ‘Field name’ property is only present in ‘outer html’ property of UFT which contains many values including html id:

This is the outer HTML and then you find my regular expressions which did not work.

 <input tabindex="-1" class="outputBasic inputReadOnly" id="xyz_123" style="text-align: left; text-transform: uppercase;" onclick="" onfocus="require( ['xxx/editblock', 'xxx/keyHandler'], function( editblock, keyHandler){ if( !editblock.editblocks[ 'bookEdit' ]['noevents'] ){ xxx.keyHandler.prepareHandler('bookEdit'); } } );" onblur="require( ['xxx/editblock','xxx/keyHandler'], function( editblock, keyHandler ) { if( !editblock.editblocks[ 'bookEdit' ]['noevents'] ){ xxx.keyHandler.revertHandler(); } } );" onchange="if('true' === 'true'){ require( 'xxx/editblock' ).updateDscr( 'xyz_123', '', '' ); }" type="text" size="4" maxlength="3" readonly="" fieldname="acrtnMethod">

I am trying below expression:

.*tabindex="-1".*acrtnMethod.

Since, acrtnMethod present in search panel too but it differs in ‘tabindex’, hence I am using combination of tab index and field name. However, it is highlighting ‘Accretion Method Description’ field. I observed that ‘Accretion Method’ and ‘Accretion Method Description’ differs in ‘class’ I tried to add ‘class’ property but then it fails for ‘Accretion Method’ but for ‘Accretion Method Description’ it works successfully.

I also tried below expressions with no success:

  1. .*tabindex="-1".*acrtnMethod"
  2. .*tabindex="-1".*acrtnMethod".*
  3. .*tabindex="-1".*acrtnMethod">
  4. .*tabindex="-1".*acrtnMethod.

  5. .*bookEdit.*fieldname="acrtnMethod"

 ssss.PNG

This is the error that I'm getting, and 

What I observed is the ‘outer html’ which contains curly braces “}”, doesn’t support the regular expression.

e.g.

  1. Field = Accretion Method Description

Outer HTML = <input tabindex="-1" class="popup-edit-panel  inputReadOnly" id="bookEdit_13Dscr" type="text" size="35" readonly="readonly" fieldname="acrtnMethodDscr">

Regular expression = .*fieldname="acrtnMethodDscr">

 

  1. Field = Book Num from search panel

Outer HTML = <input tabindex="2" class="xxx-search-r-sc xxx-search-r-sc-input   xxx-search-r-haslov" id="bookSearch_sc_bookNum" style="text-transform: uppercase;" type="text" value="" searchtype="LONG" allowasterisksubstitution="false"    fieldname="bookNum">

Regular expression = .*fieldname="bookNum">

 

Not Working Regular expressions:

  1. Field = Accretion Method

Outer HTML = <input tabindex="-1" class="outputBasic inputReadOnly" id="bookEdit_13" style="text-align: left; text-transform: uppercase;" onclick="" onfocus="require( ['xxx/editblock', 'xxx/keyHandler'], function( editblock, keyHandler){ if( !editblock.editblocks[ 'bookEdit' ]['noevents'] ){ xxx.keyHandler.prepareHandler('bookEdit'); } } );" onblur="require( ['xxx/editblock','xxx/keyHandler'], function( editblock, keyHandler ) { if( !editblock.editblocks[ 'bookEdit' ]['noevents'] ){ xxx.keyHandler.revertHandler(); } } );" onchange="if('true' === 'true'){ require( 'xxx/editblock' ).updateDscr( 'bookEdit_13', '', '' ); }" type="text" size="4" maxlength="3" readonly="" fieldname="acrtnMethod">

Regular expression = .*fieldname="acrtnMethod">

  1. Field = Book Num from ‘Add Book Static’ pop-up

Outer HTML  = <input tabindex="-1" class="outputBasic inputReadOnly" id="bookEdit_0" style="text-align: left; text-transform: uppercase;" onclick="" onfocus="require( ['xxx/editblock', 'xxx/keyHandler'], function( editblock, keyHandler){ if( !editblock.editblocks[ 'bookEdit' ]['noevents'] ){ xxx.keyHandler.prepareHandler('bookEdit'); } } );" onblur="require( ['xxx/editblock','xxx/keyHandler'], function( editblock, keyHandler ) { if( !editblock.editblocks[ 'bookEdit' ]['noevents'] ){ xxx.keyHandler.revertHandler(); } } );" onchange="if('false' === 'true'){ require( 'xxx/editblock' ).updateDscr( 'bookEdit_0', '', '' ); }" type="text" size="5" maxlength="255" readonly="" fieldname="bookNum">

Regular expression = .*fieldname="bookNum">

 In both cases, I used ‘outer html’ along with ‘class’ property to differentiate between field on search panel and field on pop-up.

I also tried DOM objects but however only for ‘field name’ it is giving error, all other properties it is retrieving correctly:

here is the error that I'm getting,

sssssssssss.PNG

These are all my details, please any help I'm really blocked on this issue.

Many thanks

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Can you attach a screenshot of the object


Accept as solution/Give Kudos to the author if the piece of information answered/helped you to solve your problem.
All the thoughts here are mine not related to my employer nor anyone.
0 Likes
Highlighted
Absent Member.
Absent Member.

 
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.