Forum Discussion

vbace2's avatar
vbace2
Occasional Contributor
14 years ago

Can web applications use the NAME of input items instead of ID?

I am trying to test a web application.  On a page, there are a few text boxes. 



One text box has a javascript date picker on it.  This field has a name of caseopendate, and the javascript date picker creates an ID of Dp and then a 13 digit number.  This number seems to change each time you get to the page.  So, during a test where I hit the page 3 times, it mapped it as three different objects of textboxDp with a different 13 digit number each time.



Is there a way that this can be mapped to the name rather than the changing ID?



On another note, during one of my recordings, it seemed to actually map it as textboxcaseopendate also.  The steps I performed were...



1. Opened page

2. clicked on the text box

3. entered a date (the javascript date picker opened, but I just entered the date in the text box)

4. clicked on another field

5... did some other steps and then opened the same page again

6. Repeated 2-4



what was recorded was...

  panel2 = panel.panelDataArea;

  panel2.textboxTecaseopendate.Click(3, 8);     here is where it uses the name

  textbox = panel2.textboxDp1288370558750;   using ID here

  textbox.HoverMouse(41, 15);

  textbox.SetText("10/25/20");            Not sure why this is here in 3 rows. I just tried to type

  textbox.SetText("10/25/201");          out the date 10/25/2010.  It was really, really slow responding.

  textbox.SetText("10/25/2010");


  panel3 = panel.panelDataArea1;

  panel3.Click(151, 8);

  ...

  ...

  ...

  textbox2 = panel2.textboxDp1288370694719;   second time in and only ID value shows up

  textbox2.Click(3, 10);

  textbox2.HoverMouse(23, 9);

  textbox2.SetText("10/24/2010");

  textbox2.HoverMouse(23, 9);

  panel3.Click(148, 7);


2 Replies

  • sarya's avatar
    sarya
    Frequent Contributor
    Hi Dan,



    You can use various object properties to identify the object like innerHTML,innerText,title etc. Try to use object spy on the targeted object.



    You can use this piece of script code like :- page.NativeWebObject.Find("innerText","caseOpendate","A") .click();



    Also due to slow response,the setText code is displayed thrice.You can just delete the extra lines of code for setText and keep the third line only for text "10/25/2010".



    Hope it helps.

    Sumedha
  • Hi,



    Also, you can map this object manually by any properties you want (use properties with stable values). Or, you can modify the recorded Name Mapping scheme - just exclude unstable values from your object's recognition parameters.