Test execution fails after I modified variable of a ClickButton operation.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Test execution fails after I modified variable of a ClickButton operation.
I need to modify my test that it selects button in ClickButton operation by using a variable.
When I created keyword test in Value column the value displays as "...". I want to
After I changed it to a variable and used "MappedName" value of the button from Object Spy window. I use DB Table as a variable.
I'm wondering what will happen when I change the Value using variable to let's say ToolButton5, but in the Item column it will be still ToolButton2? If it says ToolButton2 in the Item column does that mean it will always look for ToolButton2 even when the value will use as variable ToolButton5.
Then I run the test it fails, when it gets to the step where it should click on the button after I changed from "..." to the variable the error details say: "Exception. Type mismatch".
What can cause this error?
- Labels:
-
Desktop Testing
-
Keyword Tests
-
Variables
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So if the variable ProjectSuite.Variables.Config_DDL_Meteor["TC_Chip_button"] has the value assigned "Aliases.IsoSpeak.MainOptionsModule.centralWidget.uiLayoutWidget.NewProjectMenuModule.Widget3.Widget.ToolButton2".
What are you trying to do with ProjectSuite.Variables.Config_DDL_Meteor["TC_Chip_button"]?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The idea is that "Aliases.IsoSpeak.MainOptionsModule.centralWidget.uiLayoutWidget.NewProjectMenuModule.Widget3.Widget.ToolButton2" value = ToolButton.
I have 2 buttons and I want to use the same test where I can click two different buttons. I will store the buttons value in ProjectSuite.Variables.Config_DDL_Meteor["TC_Chip_button"] DB Table.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I'm starting to understand the problem you are having. You have a table that has e.g. ToolButton2, ToolButton1, ToolButton3 etc. and you want to perform a click button action based on the value received from the table i.e. ToolButton2.ClickButton()
Similar to the code example,
Aliases.IsoSpeak.MainOptionsModule...Widget.ToolButton2.ClickButton()
Aliases.IsoSpeak.MainOptionsModule...Widget.ToolButton1.ClickButton()
Aliases.IsoSpeak.MainOptionsModule...Widget.ToolButton3.ClickButton()
You can use eval() function to evaluate JavaScript code represented, which means creating a function and calling the code from your keyword test.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that's exactly what I want! My test should create 6 different projects, where each project is == to a different button("Aliases.IsoSpeak.MainOptionsModule.centralWidget.uiLayoutWidget.NewProjectMenuModule.Widget3.Widget.ToolButton2"), in total there are 6 buttons. So, I will have 6 lines with values in my DB Table, later I plan to make it data driven loop.
I never used eval() will check it now.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found that I can do it under Operation Parameters:
This is how my test step looks like(it's a different button, but concept is the same):
When I run it I keep getting an Exception error: "Unable to evaluate the operation's "Shift" parameter. Error: RuntimeError: The specified object is not indexable"
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, I just found in TC documentation that Shift is a button:
Parameters
The method has the following parameter:
Shift
Specifies the key that will be pressed during the click. See TShiftKey.
Now I'm confused, can I even use a variable for ClickButton operation if it refers to a key not to the object?
From documentation: "You can click a button by simulating keystrokes that represent an access key. An access key is an underlined symbol within the button caption. It permits a click of a button by pressing the ALT key in combination with the assigned access key. For example, if the underlined symbol is F, you should simulate pressing the ALT+F key combination (for detailed information about simulating keystrokes, see the Simulating Keystrokes topic)."
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't understand why you are using Shift, and I don't know if ClickButton accepts any parameters.
This is the reason I'm not able to provide a proper solution, because it's confusing!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not using a Shift, it's by default. I just showed here that TC uses key as a value, maybe it accepts only key as value for this operation.
I was using a variable and when I was using a variable it didn't work because of Exception - Type mismatch.
Maybe this is a reason why it says "Type mismatch." because variable is a different type.
I can't find any information. I created TC support ticket yesterday about this, but didn't get a respond yet.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is what the script code looks like for your scenario,
function HighlightButtons()
{
// URL: https://www.w3schools.com/bootstrap/bootstrap_buttons.asp
var btn1 = 'Sys.Browser("chrome").Page("https://www.w3schools.com/bootstrap/bootstrap_buttons.asp").Panel("belowtopnav").Panel(0).Panel("main").Button(0)';
var btn2 = "Aliases.panelMain.buttonDanger";
var btn3 = "Aliases.panelMain.buttonDefault";
var btn4 = "Aliases.panelMain.buttonInfo";
var btn5 = "Aliases.panelMain.buttonLink";
Sys.HighlightObject(btn1); // Error: Type mismatch.
Sys.HighlightObject(eval(btn1));
Sys.HighlightObject(eval(btn5));
}
Whether using the full name (btn1) or the alias name (btn5), using eval function evaluates JavaScript code represented as a string and returns its completion value. The source is parsed as a script.
Notice that the first Sys.HighlightObject throws an error.

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »