How to capture the dynamically changing datas in web page thru QTP coding?any sample coding for the above

Showing Answers 1 - 16 of 16 Answers

kannan

  • Feb 23rd, 2006
 

thanks you vinoth but can u give me any sample code by using this GETROProperty. so that will be helpful

  Was this answer useful?  Yes

ramnarayan

  • Mar 8th, 2006
 

Dim ValueValue= Browser("Browser Name").Page("Page Name").Frame("mainFrame_5").WebElement("12").GetROProperty("innertext")This code takes the value of the attribute "innertext" of the object "12",which is changing dynamically.This can be checked with an Output Checkpoint

the content of objects in a web page or application changes due to  dynamic content ,u cn create dynamic descriptions of these objects so that quick test will recognize them when it runs the test. you can use SetToproperty method to modify object properties during test run without changing the properties valuesin the object repository, you can use set of the properties that QT  uses to identify the object .so that it will be able t identify the object even some of its properties change dynamically. you can use object properties dialog box, object repository , regular expression in that to identify the object, after that use GetRoproperty method  to capture the content of dynamically  changing object.

syntax:Browser(<browsername>).page(<page name>).webelement(<web object>).SetToProperty "Index" , 2

syntax:Browser(<browsername>).page(<page name>).webelement(<web object>).GetRoProperty(<property>) or use (text)

  Was this answer useful?  Yes

kvidy

  • Apr 30th, 2008
 

Is that we can form a loop and run it after every interval ( once we track time duration).

  Was this answer useful?  Yes

kiranpaul20

  • Jun 16th, 2010
 

In order to capture the value of an object and that too of a dynamic object then we will use the GetROProperty which means Get Run Time Object Property and we need to decide which property we want to capture. This can be text, innertext etc.

I would list down a sample code for gmail to count unread emails from any account.

Since the inbox count is dynamic and ever changing from account to account i have used descriptive programming so that this peice of code can be run for any gmail account.

The pre requiste is that you login to your gmail account. and then run thsi script

this script prints the number of unread emails in the inbox.

inboxcount = Browser("title:=Gmail.*").Page("title:=Gmail.*").Link("innertext:=Inbox.*").getroproperty("innertext")
If inboxcount = "Inbox" Then
 Print "No Unread Emails"
 ExitAction

 Else
 
emailcount = replace(inboxcount, "Inbox","") 'replaces inbox with space
emailcount = Rtrim(ltrim(emailcount)) 'removes all the spaces
emailcount = replace(emailcount, "(","")  
emailcount = replace(emailcount, ")","")

Print "You have "&emailcount& " unread emails in your inbox"

End If

Kiran Paul

  Was this answer useful?  Yes

TesterVinni

  • Oct 30th, 2015
 

My task in hand requires to automate a page which ask random questions, based on customers credit history. I am unable to fetch the question from the inner html/innertext/outertext of the Webelement of the webpage. Can you please help me out..
Code:-
- Regards,
TesterVinni

Code
  1. Set objpage1 = Browser("Cards_3").Page("Cards").Object

  2. Text1 = "With which branch location do you have an active personal or home equity line of credit?"

  3.  

  4. str = GetPageAllStringA(objpage1,Text1)

  5. msgbox str

  6.  

  7. Function GetPageAllStringA(obj, Textvalue)

  8.  

  9.     Set objChildren = obj.childNodes

  10.  

  11.     If  objChildren.length = 0 Then

  12.         GetPageAllStringO = obj.innerText

  13.         Exit Function

  14.     End If

  15.  

  16.     For i = 0 to objChildren.length - 1

  17.         set obj = objChildren.item(i)

  18.         GetPageAllStringO = obj.innertext

  19.                 If StrComp (GetPageAllString,Textvalue,1) = 0 Then

  20.                          return true if found

  21.                         GetPageAllStringA = True

  22.                         Exit Function

  23.                 Else

  24.                          return true if  not found

  25.                         GetPageAllStringA = False

  26.                 End If        

  27.     Next

  28.        

  29. End Function

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions