Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with a dynamic parameter
#1
Solved: 11 Years, 4 Months ago
I'm facing a problem on my test that I'm doing for the company that I work for, I'll try to explain the best way possible.

In a specific page on the web site has a label that have a transaction authentication number, and as you might guess, it is a random number.

So far I know, I'll need to program a function to treat that. The web site will generate a random number, then I need to find that number on a table (maybe?) and fill the specified field with the correspondent code number from that random generated number.

The worse is that my knowledge on scripts in vb is very low, but I think with a code like that I'll resolve the problem.

If someone has some exemple similar to mine, I ask to give me a hand to solve this problem.

Thanks in advance.
Reply
#2
Solved: 11 Years, 4 Months ago
Well, after so many tries, finally I did something to start to fix my problem:

Quote:set ex= CreateObject("Excel.Application")
Set a=ex.Workbooks.open("c:\Book3.xls")
Set b=a.worksheets("Sheet1")

dim fieldcheck, branch1, label

label = "Branch(three-digit)"

i=1

While (label <> fieldcheck)
fieldcheck=b.Cells(i, "A").value
If label = fieldcheck Then
branch1=b.Cells(i, "B").value
End If
i = i+1
Wend

Browser("...").Page("...").WebEdit("branch").Set branch1

I used a variable to store the label value on web site, then in while I search for the row that has the same value than label.

Now I need one more thing, The label that I have to compare has a value that changes everytime (i.e. "TAN No. xxx", where xxx is the varying number)

I don't know how to do that, I was thinking something about checkpoint that field. Or maybe a way to read that field on the site and assign the value to a variable and compare.
Reply
#3
Solved: 11 Years, 4 Months ago
Well, after many hours of searching on the internet I finally found how to hadle that error.

But now I have another, it's a stupid question but I don't know how to do that. In the QTP tables I need to put some dates to do some tests. But the site returns me other message because the sheet hide the zeros (I fill the sheet with "01" then the sheet "turn" to the number "1")

I found a way to do that open the sheet on excel and changing the number format to text.

There's another way to do that? I can't found in QTP an option to change the format to text.
Reply
#4
Solved: 11 Years, 4 Months ago
Try putting the values in an Excel, format them to text, and import the excel into your datasheet. [Right-clicking on the datasheet gives an option to import]. I did not specifically try this myself... Just a thought.
Reply
#5
Solved: 11 Years, 4 Months ago
Thanks mate! I did that and it works. Another way it's fill the cell with '01 and also works. Big Grin
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Action Parameter passing problem Qtpuser1 1 2,843 04-18-2014, 06:23 AM
Last Post: kgovadav
  Parameter bistritapcv 0 2,357 04-02-2013, 09:10 PM
Last Post: bistritapcv
  Parameter iteration bistritapcv 1 3,402 03-28-2013, 10:40 AM
Last Post: Sathiya
Question Add parameter to Data table during run time switoo 1 3,001 12-06-2012, 02:37 AM
Last Post: frebuffi
  Parameter values VS Environmental Variables Brian.Osborne 1 2,379 10-11-2012, 01:47 PM
Last Post: harishshenoy

Forum Jump:


Users browsing this thread: 1 Guest(s)