Micro Focus QTP (UFT) Forums
Spying Autofill in google - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Spying Autofill in google (/Thread-Spying-Autofill-in-google)



Spying Autofill in google - soumya - 12-04-2011

Good Afternoon,

I am running some basic web scripts at the moment. I want my script to retrieve some words from an excel file and post it in google search . And click on submit.

I am using descriptive programming and am unable to find out the class name for the autofill box that appears as soon as we begin typing in it.

Thank you so much

Soumya



RE: Spying Autofill in google - prasant - 12-04-2011

Hi,
I used Object Spy and can see the properties as below -

class - WebEdit
name - q

Please post a screen shot of the auto fill box if you are still not able to get it.


RE: Spying Autofill in google - soumya - 12-04-2011

Hi prasant,

I typed a basic script of 2 lines
Code:
browser("name:=Google").page("title:=Google").webedit("name:=q").Set "qtp"
browser("name:=Google").page("title:=Google").webbutton("name:=Google Search", "value:=Google Search").Click

The first statement is executed, the text 'qtp' is inserted into the text box.
The second statement is not executed and the following error is displayed.
The "[ WebButton ]" object's description matches more than one of the objects currently displayed in your application. Add additional properties to the object description in order to uniquely identify the object.

Thank you so much for your time.

Soumya


RE: Spying Autofill in google - prasant - 12-05-2011

Hi Soumya,

The error message itself tells about the problem.
QTP finds more than one object with the description properties given by you and unable to recognize object.

You need to use ordinal identifier in this case.

Use below code, it should work -

Code:
browser("name:=Google").page("title:=Google").webbutton("name:=Google Search", "index:=0").Click



RE: Spying Autofill in google - nistalaramesh - 12-05-2011

Hi,
I used this code and it worked (I am using QTP-11, in QTP 9.2 also it worked)

Code:
Browser("title:=Google").page("title:=Google").WebEdit("name:=q").Set DataTable.Value("SearchID")
Browser("title:=Google").page("title:=Google").WebButton("name:=Google Search").Click