Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to proceed in QTP when all fields are prefixed with ctl00_ContentPlaceHolder1
#1
Not Solved
In my web Application all controls are prefixed as below example:

ctl00$ContentPlaceHolder1$txtAssetNumber
ctl00$ContentPlaceHolder1$txtAssetDesc
ctl00$ContentPlaceHolder1$txtRefAssetNumber

This is a .Net web Application
I am using HP UFT11.5.
Qtp Identifying all text boxes like "ctl00$ContentPlaceHolder1$txtAssetNumber" and even for dropdowns, Radio Buttons, Checkboxes the prefix "ctl00$ContentPlaceHolder1$" comes in place.

The Prefix changes from page to page if the same text box present in different pages.

In Coding developer named the text box as "txtAssetNumber" But runtime the name changes dynamically as above mentioned.
But txtAssetNumber is the actual field name.

Attaching the view source of the page.

Code:
<div class="middlemain">
                        <div class="middleleft">
                            <span id="ctl00_ContentPlaceHolder1_lblAssetNumber_Desc">Asset Number/Desc</span>
                            &nbsp;:<span class="mandetory">*</span>
                        </div>
                        <div class="middleRight">
                            <input name="ctl00$ContentPlaceHolder1$txtAssetNumber" type="text" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$txtAssetNumber\',\'\')', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="ctl00_ContentPlaceHolder1_txtAssetNumber" disabled="disabled" tabindex="1" class="textField" style="width:65px;" />
                            <input name="ctl00$ContentPlaceHolder1$txtAssetDesc" type="text" maxlength="32" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$txtAssetDesc\',\'\')', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="ctl00_ContentPlaceHolder1_txtAssetDesc" tabindex="1" class="textField" style="width:230px;" />
                            <span id="ctl00_ContentPlaceHolder1_RequiredFieldValidator2" style="color:Red;display:none;">*</span>

How can i proceed scripting using OR in QTP ??
Reply
#2
Not Solved
You can use regular expression for name property in OR. For ex:".*txtAssetNumber"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to handle the hidden fields using vbscript? Rameshkatru 0 2,751 11-17-2011, 12:33 PM
Last Post: Rameshkatru
  How to select a specific field and value when there is multiple fields with same obje venkatbatchu 4 3,258 08-12-2009, 07:05 PM
Last Post: Saket

Forum Jump:


Users browsing this thread: 1 Guest(s)