Recovery scenario doesn\'t work on Google search?
I'm trying to create a very simple script that go to google.com and do a search, also keeping track of the # of results found and output it to the dataTable.
The DataTable has two columns; "searchQuery" and "NumberOfResults".
Here is the code:
<font class="small">Code:</font><hr /><pre>
sQuery = DataTable("searchQuery", dtGlobalSheet)
Browser("title:=Google").Page("title:=Google").Web Edit("name:=q").Set sQuery
Set objTitle = Description.Create
objTitle("title").Value = sQuery + ".*"
The script above run fine most of the time.
Sometimes, I got a problem that after clicking on the search button, the result doesn't came out (Need to press enter instead, this is how google work, not my fault). See screenshot:
Therefore, my script halt and couldn't get the # of results.
I attempt to create a recovery scenario for that by going through "Recovery Scenario Wizard">Select Trigger Event(Object state)> Select Object(point to "Press enter to search.")> Recovery Operations(Keyboard click: Enter).
However, it seems my recovery scenario doesn't work/trigger at all. I'm wondering whether it would be possible to do recovery scenario by script instead of using the Wizard?
Any advices? Thanks (FYI, I'm using QTP 11 with IE9)
Re: Recovery scenario doesn\'t work on Google search?
Okay I found a 99% solution to the problem:
by adding: "Wait(1)" after putting the search query in the search box and before pressing the search button. So no need recovery scenario at all.
However, whenever I put "g" as search query, it's not able to return the # of results, don't know why....any idea?