Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inserting variable values into Descriptive Programming Functions
#1
Not Solved
Hello All,
I'm trying to use a general function in my function library to click links.  I used variables to define property values.  The values for the link properties are coming from the same row as my Teststeps in the Excel file from columns IP1 and IP2.  However, when the clickLink function is called the second time it's still using the previous values ie. not pulling values from current Teststep row.

Some columns I could use as identifiers are TSID, Keywords, IP1, IP2

I would really appreciate any help fixing this!

Function Library Code:

Code:
Function clickLink(dData, dData2)
   dData=datatable.Value("IP1","dTeststeps")
   dData2=datatable.Value("IP2","dTeststeps")
   Browser("micclass:=Browser").Page("micclass:=Page").Link("name:="&dData,"html tag:=A", "text:="&dData2).Click
End Function

Main Code Call from Select/Case:

Code:
Case "clickLink"
dData=datatable.Value("IP1","dTeststeps")
dData2=datatable.Value("IP2","dTeststeps")
Call clickLink(dData, dData2)

Thanks in advance,
Scott K.
Reply
#2
Not Solved
You have to set the Data table row by using "SetCurrentRow" method so that the Row will change from previous to next row then you should be good.

Code:
'i - is the row which you want to set
DataTable.SetCurrentRow(i)

Alternatively you can use
Code:
DataTable.SetNextRow
After clicking so that the row selection will change to next row.
Thanks,
SUpputuri
Reply
#3
Not Solved
Code:
Dim Rowcount, webrowcnt
Rowcount=datatable.getsheet"Sheet name".GetRowCount

For i=1 to Rowcount
Datatable.GetSheet"Sheet name".SetCurrentRow(i)
Browser("").Page("").Link("").Click
Browser("").Page("").WebEdit("").Set DataTable("Row1", dtLocalSheet)
Browser("").Page("").WebButton("").Click

webrowcnt=Browser("").Page("").WebTable("").RowCount

For n=3 to webrowcnt  (note: n=3 because the data I need starts on row 3)
If webrowcnt > 3 Then (note: this is where I want it to create a new row if there is more than 3 rows of data)
For i=4 to webrowcnt
some code here to create however many rows of data the account number has.
Next
End If
column1 = Browser("").Page("").WebTable("").GetCellData(n, 1)
DataTable("column1", dtLocalSheet)=column1
column2 = Browser("").Page("").WebTable("").GetCellData(n, 2)
DataTable("column2", dtLocalSheet)=column2
column3 = Browser("").Page("").WebTable("").GetCellData(n, 3)
DataTable("column3", dtLocalSheet)=column3
column4 = Browser("").Page("").WebTable("").GetCellData(n, 4)
DataTable("column4", dtLocalSheet)=column4
column5 = Browser("").Page("").WebTable("").GetCellData(n, 5)
DataTable("column5", dtLocalSheet)=column5
column6 = Browser("").Page("").WebTable("").GetCellData(n, 6)
DataTable("column6", dtLocalSheet)=column6

Browser("").Page("").Link("").click (note: link to return to home page to  restart on new account number)
Next
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic descriptive Programming issue in Terminal Emulator cprasad 1 1,959 04-25-2019, 08:17 PM
Last Post: Ankur
  UFT Tool support with Descriptive programming laks 1 1,798 07-05-2018, 05:31 PM
Last Post: Ankur
  UFT Descriptive Programming objects not identified in a secure & private intranet env bugfinder2 1 1,840 06-07-2017, 01:41 PM
Last Post: Ankur
  UFT descriptive programming Browser("creationtime:=-1") not always working SOUMYADEEP 0 3,094 01-20-2017, 01:53 AM
Last Post: SOUMYADEEP
  Using static descriptive programming how to count no. of objects on any webpage alpha1 4 6,988 08-11-2015, 08:48 PM
Last Post: kotaramamohana

Forum Jump:


Users browsing this thread: 1 Guest(s)