Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to count total no of links in a page and click one by one
#4
Solved: 11 Years, 4 Months ago
That's correct we cannot print a method action.The code returns general error though print is excluded in the second iteration as the reference is lost due to Browser().back.
Here is a small demo to justify this statement.
Code:
Set oPage=Browser("name:=Google").Page("title:=Google")
Set oSearch=oPage.WebEdit("name:=q")
Set oSearchButton=oPage.WebButton("name:=Search")
oSearch.Set "Learn QTP"  'runs fine without any error
Browser("name:=Google").Refresh 'or back..
oSearch.Set "Learn QTP" 'throws error
Each QTP object has a hidden method "Init" to reinitialize the object cashe. Using Init on the object makes sure that it is re-identified.With QTP 11, new method "RefreshObject" has been introduced.
Code:
Set oPage=Browser("name:=Google").Page("title:=Google")
Set oSearch=oPage.WebEdit("name:=q")
Set oSearchButton=oPage.WebButton("name:=Search")
oSearch.Set "Learn QTP"  'runs fine without any error
Browser("name:=Google").Refresh
oSearch.RefreshObject 'reinitializing the object 'oSearch'
oSearch.Set "Learn QTP New" 'runs fine without any error
Reply


Messages In This Thread
RE: I want to count total no of links in a page and click one by one - by ravi.gajul - 07-22-2013, 01:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  click each web link in a page using Index or other method in QTP smeijer 13 24,723 04-29-2017, 04:53 PM
Last Post: kowshik
Question Webtable contains cell contains two links, how to click on link srinivassure 9 53,530 07-30-2016, 03:41 PM
Last Post: Akshay
  VB Script to count number of links in a web page. Suma Parimal 4 25,281 07-01-2015, 12:59 PM
Last Post: govind
  This code does not give total no of links present on page plz help it returns 0 excellentpawan 8 5,637 01-17-2015, 07:49 PM
Last Post: yogi4tech
  Right Click On a Image and Click on a Link in WebElement RameshKrishnan 4 5,432 07-10-2013, 04:13 PM
Last Post: RameshKrishnan

Forum Jump:


Users browsing this thread: 1 Guest(s)