Selection value in Vertical Scrollable Drop Down

110 views
Skip to first unread message

learningQTP

unread,
Dec 21, 2012, 9:09:54 PM12/21/12
to qtp-ele...@googlegroups.com
Can you please give automation code for below scenario:
A scenario where there are lot of values in drop down box such that the drop down box itself has vertical scrolling bar and after vertical scrolling, selecting a value from that.
 
Manual steps are as below:
1) Open browser and type URL - http://www.google.com/
2) Click on News tab.
3) From the Select Edition drop down, scroll vertically down to select Hindi(India) edition.

Jitendra.S

unread,
Dec 22, 2012, 11:22:41 PM12/22/12
to qtp-ele...@googlegroups.com

Record and run you will get automation code :)

~J~

eLearn Team

unread,
Dec 23, 2012, 1:13:57 AM12/23/12
to Jitendra.S, QTP eLearn Team
All,

If QTP does not record or can not identify the objects correctly, try Descriptive Programming. For example, I can use object spy or add the items to OR and below is how the code could look.

Browser("MSN.com").Navigate "http://www.google.com/"
Browser("MSN.com").Page("Google").Link("News").Click

Set myO = description.Create()

myO("micClass").value = "WebElement"
myO("html tag").value = "DIV"
myO("innertext").value = "India Edition"
myO("index").value = 1
wait 2
Browser("MSN.com").Page("Google News").WebElement(myO).Click

myO("innertext").value = "India"
myO("index").value = 3
wait 2
Browser("MSN.com").Page("Google News").WebElement(myO).Click

--
You received this message because you are subscribed to the Google Groups "QTP eLearn Team" group.
To unsubscribe from this group, send email to qtp-elearn-te...@googlegroups.com.
Visit this group at http://groups.google.com/group/qtp-elearn-team?hl=en-US.
 
 



--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karthik's eLearn Team
ITeLearn.com QTPeLearn.com | SeleniumeLearn.com
learn@itelearn.com
+1-314-827-5272 (US)
+91-970-453-6245 (INDIA)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Like us on Facebook: http://www.facebook.com/Itelearn
Follow us on Twitter: https://twitter.com/ITeLearn
Did you watch my free demo videos on YouTube.com/qtpelearn?

learningQTP

unread,
Dec 30, 2012, 12:01:21 AM12/30/12
to qtp-ele...@googlegroups.com
I noticed that your provided script assumes India edition as a default. Hence before running your provided script, I opened IE and visited Google News and select India edition to make it as a default. Then closed IE and ran your provided script but it gave general run error on the line of WebElement(myO).Click

I wanted to the default drop down as U. S. edition and then select India from scrollable drop down list. Hence I opened IE and visited Google News and selected U.S. edition to make it as a default. I changed script a bit - I added Dim statement for myO and changed few things (innertext U.S. edition, index value 0) as under and re-ran again but still no luck. It is giving the same run error on the same line WebElement(myO).Click. Can someone please help? Thanks.

Browser("IE").Navigate "http://www.google.com/"
Browser("IE").Page("Google").Link("News").Click
Dim myO
Set myO = Description.Create()
myO("Class").Value = "WebElement"
myO("html tag").Value = "DIV"
myO("innertext").Value = "U.S. edition"
myO("index").Value = 0
wait 5
Browser("IE").Page("Google News").WebElement(myO).Click
myO("innertext").value = "India"
myO("index").value = 3
wait 5
Browser("IE").Page("Google News").WebElement(myO).Click

Jitendra.S

unread,
Jan 1, 2013, 9:44:10 PM1/1/13
to qtp-ele...@googlegroups.com

Here is you are doing wrong

myO("Class").Value = "WebElement"
 
It should be

myO("micClass").Value = "WebElement"

In DP we have to assign value to  micClass instead of Class..you might think Y it is like that ?Because it is showing as Class in Object Spy ??  Answer is It internally defined as micClass So

Dim myO
Set myO = Description.Create()
myO("Class").Value = "WebElement"
myO("html tag").Value = "DIV"
myO("innertext").Value = "U.S. edition"
myO("index").Value = 0
wait 5


~J~
Reply all
Reply to author
Forward
0 new messages