Highlighted
Absent Member.
Absent Member.
316 views

Input Param in Function returns Empty after Error

Hi

 

I am experiencing the following issues:-

 

In my function, it accepts a range of input parameters. This works successfully and my steps execute as required. However, if for example the control isn't on screen or exists then the method/test step will fail. 

 

When this fails, the input params which are used in the failed step (client.ElementListSelect) , list and elem now return empty value. 

 

This will then affect any methods following this as the params are empty. I have tried using ByVal but this has not helped. 

 

I am now stuck on debugging why this occurs. Any information or tips would be great. 

 

Below is a sample function I have created to demo this. I am working with Borlands Silk Mobile  API. 

 

Function ListSelectItem (ByVal Zone,ByVal elem,ByVal list)

	Err.Clear
	On Error Resume Next
	
		Set client = environment("Client")
		client.Connect "127.0.0.1", 8889
		client.SetProjectBaseDirectory "C:\\Users\\colinm\\workspace\\Android"
		client.SetDevice "adb:Silk HTC One M7"
				
		client.ElementListSelect list, elem, 0, true

'the elem and list parameter will now be empty after the above call failed!	
		
		If Err.Number<>0 Then
			
			MsgBox elem 'empty value
                        MsgBox list 'empty value
			
		End If

	On Error GoTo 0
	
End Function

Thanks

 

 

 

0 Likes
3 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Input Param in Function returns Empty after Error

Use the ElementListVisible method to verify the existence of the item & then select it.

 

 

 

_____________________
Rajkumar Rajangam
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Input Param in Function returns Empty after Error

The issue is not with the specific method used in my example code. I can use any method as long as it fails/returns error then this issue occurs. 

 

If my method call is using any of my input parameters and this method then returns an error, the input parameters in the function are suddenly set to "empty" and no longer the passed in value. 

 

This leads to any methods after the failed one  for example in logic to deal with the first method failing, also failing as the parameters are empty. 

 

 

0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: Input Param in Function returns Empty after Error


@GRRUMPUS wrote:

 

When this fails, the input params which are used in the failed step (client.ElementListSelect) , list and elem now return empty value. 


 This function 'client.ElementListSelect' is provided by the Borlands Silk Mobile API, right?

 

Normal behavior is, as you say, that the parameters stay intact even though that the called function fails. Could the connected API from Borlands be the problem here?

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.