Micro Focus QTP (UFT) Forums
Not able to set value from a drop-down box - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Not able to set value from a drop-down box (/Thread-Not-able-to-set-value-from-a-drop-down-box)



Not able to set value from a drop-down box - EldonKing - 02-10-2011

resubmitted as seperate thread:
SadWe have a simular problem. We are using the record options as we build our automated scripts, and recording the response from the drop-down entries. However, when runing the automated script, it will stop at the Drop-down. If I am using the Run in maintenance mode, I can select the drop-down and then it will accept the entry, and complete the block, and stop at the next drop-down. Once I have done this for the entire repository object. it looks identical to what was originally in the Script. Unfortunately, when I again run the Script with the new changed script it does exactly the same thing stoping at the drop-down stating it can not proceed. It would appear that the Drop-down structure is not recoginzed. In one case I actually used the Set statement to enter the data into the space rather than using the drop-doen, but even this has had limited success since it can not wotk when a drop-down includes s second level dropdown selection. Any Idea how I can get around this problem?
Code:
'
Browser("Browser").Page("Page_3").WebButton("New Initiative").Click
Browser("Browser").Page("Home - Initiative Tracking_2").WebEdit("ctl00$ctl13$UserControlHost1$c").Set "King0004"
'It stops at each of the next steps
Browser("Browser").Page("Home - Initiative Tracking_2").WebEdit("ctl00$ctl13$UserControlHost1$ctl00$txtSubject").Set "Test Tracking System"
Browser("Browser").Page("Home - Initiative Tracking_2").WebList("ctl00$ctl13$UserControlHost1$c").Select "Transition"
Browser("Browser").Page("Home - Initiative Tracking_2").WebEdit("ctl00$ctl13$UserControlHost1$ctl00$txtVendor").Set "SSB"
Browser("Browser").Page("Home - Initiative Tracking_2").WebList("ctl00$ctl13$UserControlHost1$ctl00$ddlLeadTenet").Select "Mitigate"
Browser("Browser").Page("Home - Initiative Tracking_2").WebList("ctl00$ctl13$UserControlHost1$ctl00$ddlInitiativeStage").Select "Unassigned"
Browser("Browser").Page("Home - Initiative Tracking_2").WebEdit("ctl00$ctl13$UserControlHost1$ctl00$txtSeniorPoints").Set "Test Master"
Browser("Browser").Page("Home - Initiative Tracking_2").WebEdit("ctl00$ctl13$UserControlHost1$c_2").Set "Test Procedure"
Browser("Browser").Page("Home - Initiative Tracking_2").WebList("ctl00$ctl13$UserControlHost1$ctl00$ddlSeniorPointsClass").Select "U//FOUO"
Browser("Browser").Page("Home - Initiative Tracking_2").WebEdit("ctl00$ctl13$UserControlHost1$ctl00$txtLongDescription").Set "Long Description of test for Tracking System"
'Updated by test maintenance run


Error received ....
The "ctl00$ctl13$UserControlHost1$ctl00$txtSubject" WebEdit object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name for the object.

Line (4):
Code:
"Browser("Browser").Page("Home - Initiative Tracking_2").WebEdit("ctl00$ctl13$UserControlHost1$ctl00$txtSubject").Set "Test Tracking System"".

Tip: If the objects in your application have changed, the Maintenance Run Mode can help you identify and update your steps and/or the objects in your repository. This code was created in the Maintenance Run. Sad


RE: Not able to set value from a drop-down box - Ankur - 02-10-2011

This is an issue of dynamic object properties. First check which properties are dynamic and then either make those as regex or pass object properties at run time.


RE: Not able to set value from a drop-down box - EldonKing - 02-11-2011

Sad Sorry, I didn't understand a word you said, "dynamic object properties", "make those as regex or pass object properties at run time" what does this mean to a novice?
I have created an Object repository for each screen, I just use recording mode to go throught the test manually, but when I run the automated script, it does not work. I have manage some minor success by rearanging the data entries to complete the form by rows rather than columns. But when I click Creat at the bottom of the screen rather than staying in the same browser windo it opens another Window, and My system gives me access denied but recognizes who I am.
Why is it opening is a seperate window, when I recorded the process it did not do that?


RE: Not able to set value from a drop-down box - Ankur - 02-18-2011

(02-11-2011, 07:15 PM)EldonKing Wrote: Sad Sorry, I didn't understand a word you said, "dynamic object properties", "make those as regex or pass object properties at run time" what does this mean to a novice?

Lets say you record upon an object and one of the properties value gets recorded as "xyz" in Obj Rep. Now whenever you run upon that object you see that object property keeps on changing. (can be checked using spy) Such properties are known as dynamic properties and should be handled using regex OR by passing properties at run time OR may be by removing them altogether from the object repository - as per the need of test.

I guess, it would take us a lot of post exchanges before we can tell you the specific code for your case. I would suggest taking help/training in your organization for quicker response.