Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to randomly Select any category link and randomly click on one of its options ?
#1
Not Solved
I m a fresher in QTP and want to learn Dynamic Descriptive Programming. I took HDFC bank website as an example and working on it. I was stuck at one point and kindly need your help.

I took a scenario like this:
QTP has to click on any of the category links randomly, then a drop down menu expands and has to randomly again select one of the options in that and then again randomly select the links in it finally.

Example:
The following is an example scenario, but i need this randomly.
QTP clicks "Products" link -----> Cards -------->Credit cards

Here is the code I prepared. But couldn't go forward:

Code:
'randomly Select any category link and click on one of the options.
SystemUtil.CloseProcessByName "chrome.exe"
SystemUtil.Run "chrome","http://www.hdfcbank.com/"

Function sRandNum(iMax,iMin)
        'Create Random Number within the Range
    Randomize
    sRandNum = Int(((iMax - iMin) * Rnd) + iMin)
End Function

'It only selects products,making payments or ways to bank links only
slRandomNumber=sRandNum(3,1)

Set MyBrowser= Browser("title:=.*")
Set MyPage= MyBrowser.Page("title:=.*")

Set hLink=Description.Create()
hLink("class").value="mainlink"
hLink("html tag").value="A"
hLink("height").value ="20"
hLink("innertext").value =".*"
hLink("index").value =slRandomNumber

MyPage.Link(hLink).FireEvent "onmouseover"

MyPage.WebElement("class:=mainlink","height:=35","html tag:=SPAN","innertext:=.*").FireEvent "onmouseover"

MyPage.Link("html tag:=A","height:=16","innertext:=.*","Index:=.*").Click


Thanks in advance.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Date Picker Issue - Unable to select date link dynamically rajkumarsm 1 5,174 09-20-2014, 09:31 AM
Last Post: rajkumarsm
  How to click on a dynamic link on a website Geekgirl 3 4,525 11-28-2013, 11:53 AM
Last Post: Jay
Sad Not working if not hard coded (web link).click dlaureano 2 2,885 02-11-2013, 12:57 PM
Last Post: ravi.gajul
  NEED help with scripting. Web table, Click Link Clymo 4 7,611 06-08-2012, 08:41 PM
Last Post: sreekanth chilam
Exclamation QTP - Code to select a link Unleash Rajesh 3 17,134 01-03-2012, 06:57 PM
Last Post: prabhukrishna

Forum Jump:


Users browsing this thread: 1 Guest(s)