Highlighted
Absent Member.. Absent Member..
Absent Member..
1047 views

How to pass the value from the datatable to the webelement and select that item.

Hi Guys,

 

I have two issues here 1) Recognizing each item that are in WebElement by using for loop. My scenario is :

a = Browser("xxxxx").Page("xxxx").WebElement("xxxx").GetRoProperty("innerntext")

b = Split(a, ",",-1,-1)

for i = lbound(b) to Ubound(b)

Print b(i)

Next

My code is working fine but the problem is : if the webelemet text is "abcd,aefgh".. i need "abcda" ,"efgh". I tried to parametrize in the datatable by mannually inputting the text. How to pass the manually inputed text to the webelement and select the item in the table?

 

0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

Re: How to pass the value from the datatable to the webelement and select that item.

try following

 

Browser("name:=xxx").Page("title:=xxxx").WebEdit("xxx").Set DataTable.value(column_number,sheet_number)

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: How to pass the value from the datatable to the webelement and select that item.

You can use the ANSI Character representation of , in QTP, here is simple way:

a = "abcda"
b = "efgh"
c = a & Chr(44) & b
MsgBox c

Mark Smith
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How to pass the value from the datatable to the webelement and select that item.

Hi,

Is it so that you want to change the innertext attribute for a webElement to identify an item in application? What you need is to define a webElement in your OR with innertext as its attribute, then change its value through run time using SetToProperty.

Every time you need to identify the WebElement with a new innertext, use the following code to point the object to the correct item in your application:
WebElementText = DataTable.Value("YourColumn","dtLocalSheet")
Browser("xxxxx").Page("xxxx").WebElement("xxxx").SetTOProperty "innertext", WebElementText

0 Likes
Highlighted
New Member.

Re: How to pass the value from the datatable to the webelement and select that item.

Hi All,

 

on the same issue as above, I first got a row count of the Saptable to use on a loop , which returned the row count of all visible rows even empty ones. I then used the row count to loop through the table and get cell details of a one specific column to the datatable .The challenge is when loop get to the empty row/cell it stops the script and no error is thrown,  is there a way to avoid empty/inactive rows in a saptable/webtable?

Thanks 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.