Ask a Question

Pass parameter vale in Aliases?

SOLVED
abrar22
Frequent Contributor

Pass parameter vale in Aliases?

Hi,

 

I am trying to pass the value through parameter in Aliases but its throwing runtime error. Please help

 

function FXConnectRFSClientAllin(Val)
{
var intValue= Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.wValue(Val)
return intValue
}

 

Value i am passing is '0,15'

 

A

8 REPLIES 8
Marsha_R
Community Hero

Try using that alias outside the function to assign a variable value and hard code the value in.  That will help narrow down the issue.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
tristaanogre
Esteemed Contributor

OK, first of all, everything I'm saying after this sentence is based upon guess. 

 

My GUESS... is that you're using a JavaScript project.  In the JavaScript implementation in TestComplete, there are limitations on operating on properties that are accessed via index, like wValue in your code example.  In these situations you need to use $set and $get to work with properties that have indices.

 

Change your code to the following:

 

function FXConnectRFSClientAllin(Val)
{
var intValue= Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.$get('wValue', Val)
return intValue
}

One other item of note... you might want to redo your Aliases.  There are a lot of aliases in your string that appear to be just place holders in the hierarchy.  If you're not interacting directly with "null_layeredPane", it doesn't need to have an Alias.  It is probably mapped and that can remain, but you might want to look at "compressing" your Aliases into more usable strings.  See https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/over...


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
shankar_r
Community Hero

I guess 0,15 is row and column number to get value using wValue(row,column) method.

 

If i assume correctly, then you have to pass two parameters in order to get the value, as like below.

 

function FXConnectRFSClientAllin(rowValue,ColValue)
{
var intValue= Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.wValue(rowValue,ColValue);
return intValue
}

Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

abrar22
Frequent Contributor

Tried this but still getting the runtime error as 'Type mismatch'

Can you post a screenshot where you are getting type mismatch error?


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

abrar22
Frequent Contributor

Hi, 

 

Please see the error attached. 

 

Is maybe because the row and col values are Integer types but I am passing the String type? Not sure

 

 

Type Mismatch error show me that, you have convert your string to int.

try like below,

 

function FXConnectRFSClientAllin(rowValue, ColValue) {
	try {
		rowValue = aqConvert.VarToInt(rowValue);
		ColValue = aqConvert.VarToInt(ColValue);
	} catch (ex) {
		Log.Error("Invalid inputs");
		return;
	}
	var intValue = Aliases.jp2launcher.JideSystemShell.Orders.exec_orders.RootPane.null_layeredPane.null_contentPane.SessionDetailsTabbedPanel.Panel.JideTabbedPane.BusyComponent.JXLayer.MultiOrderCardPanel.RFS_Competitive.JS_RFSOrderDetails.wValue(rowValue, ColValue);
	return intValue
}

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

tristaanogre
Esteemed Contributor

If you were passing both row and column as a single parameter, right there is your problem.  If wValue takes two parameters, you need to pass it two parameters, specifically, two integers.  @shankar_r's code is the correct code, you need to make sure that you are passing the correct number of parameters.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: