Unspecified error while selecting a date from calendar in UFT - hp-uft

I am new to UFT and automating a desktop application, I am facing challenge while setting a date from calendar picker.
Window("Application").Window("Run Process Group").WinObject("01 / 14 / 2020").Click 442,7
Window("Application").Window("Run Process Group").Window("Window").WinCalendar("SysMonthCal32").SetDate "15-Jan-2020"
In the above lines value inside WinObject("01 / 14 / 2020") changes based on prepopulated date.
Window("Application").Window("Run Process Group").WinObject("01 / 14 / 2020").Click 442,7
This line is clicking on calendar however while executing second line I am getting an error saying unspecified error "Window("Application").Window("Run Process Group").Window("Window").WinCalendar("SysMonthCal32").SetDate "15-Jan-2020""
Please help me out to make this work, my requirement is to click on calendar(but calendar object's values changes based on prepopulated date so need to parameterize this) and select date(date will be passed from an external file)

Look at your date format.
You have DD/MM/YYYY in application and you are setting date "SetDate "15-Jan-2020"". Try set it
Check this link.
Regards

Got the solution, actually I was not selecting all required UFT add ins, my application's window type is swfwindow but since I haven't selected add ins, UFT recorded it as window. after selecting add ins my issue is resolved.

Related

Disabling workbookopen Event for XLSB file

I have the following issue:
I created an Excel sheet in XLSB format.
To protect that sheet, password generated by performing some operations on present month and year which would be a numeric value.
Used input box to get a password from the user in a string variable.
step 2 and 3 done in workbookopen event.
I closed the workbook and when again opened was prompted for the password which would never match even though I know the password.
What to do now? I have tried disabling macros but it doesn't seem to work.
finally tried following command
Application.EnableEvents = False
Which does exactly what i want but is not working for my sheet, though same is working fine for another trial sheet.
Sub disableCtrEvents()
Application.EnableEvents = False 'disable Events
Workbooks.Open "<path>\Wall area.xlsb"
Workbooks.Open "<path>\STAAD to steel drawing.xlsb"
End Sub
Following three files can be dowloaded from the link
test.xlsm - containing events disabling code (written above) and code to open other two sheets.
wall area.xlsb - trial sheet to check whether events are disabled or not.
STAAD to steel drawing.xlsb - actual file wherein i want to disable workbook open event
link - https://drive.google.com/open?id=1d_3Tu_-qIYErgYVkOjrCP4b8sZagXxF1

Events not firing in StimulSoft JS reports

I’m using StimulSoft JavaScript reporting and I need to make charts in the GroupFooter of my report. I searched for the solution and I came up with the following link:
https://forum.stimulsoft.com/viewtopic.php?&t=5212
I tried it but the events in the report seem to not be working.
I prepared a sample report similar to what I need without the unnecessary data:
In this (attached) report, there is a GroupHeader, a Databand (not assigned), a GroupFooter, a chart in the GroupFooter with constant data and a variable named “myVar” with the initial value of “12”. There is also a TextBox set with {myVar} in order to see if the value of variable is changed. In the “before event” of the GroupHeader, the value of variable is changed to “98”. However, in the preview mode the event does not seem to fire and the value of TextBox is not changed.
What am I doing wrong? I checked the similar reports and they went through the same process.
I checked it on js.stimulsoft.com as the latest build.
The events are not supported in Stimulsoft Reports.JS

Coded UI Test - Set UI property not returning (hanging indefinitely)

I am getting crazy with a problem that I found when executing a Visual Studio Coded UI Test.
The scenario is as follows.
I recorded a Coded UI Tests that do the following steps in a Web Application (Microsoft Dynamics CRM 2011):
Login into an application
Navigate into a page
On the page set the selected value of a html combobox
The test is able to do all those steps without a problem, even selecting the value in the combobox.
The web application have a piece of Javascript that is executed when the selected item changes.
if one of the values is selected then an alert message is presented to the user and the application will set the selected item to a default one!
The javascript code look like this:
switch (Xrm.Page.getAttribute("status").getValue()) {
case 3: //Authorised
alert("Please use the method XPTO to update the record status to Authorised!");
Xrm.Page.getAttribute("status").setValue(1);
Xrm.Page.getControl("tatus").setFocus(true);
return false;
The UI Test method that is performing the change in the combobox is as follows:
/// <summary>
/// Select a value in the Status dropdown box
/// </summary>
public void SelectStatus()
{
#region Variable Declarations
HtmlComboBox uIStatusComboBox = this.UIHttpsappWindow200.UIModuleUITEDocument5.UIWorkplaceDashboardsFrame.UIModuleUITEDocument.UIStatusComboBox;
// Select 'Authorised' in 'Status' combo box
uIStatusComboBox.SelectedItem = this.SelectStatus_SPParams.UIStatusComboBoxSelectedItem;
}
The test method is able to change the value in the combobox, and an alert message is displayed to the user. However this part of the code uIStatusComboBox.SelectedItem = this.SelectStatus_SPParams.UIStatusComboBoxSelectedItem;
never returns and the test just hangs there until it timeouts!
I have no ideia how to work arround this issue! I was thinking that maybe the problem could be in the fact that we have javascript code that is executed after the alert is displayed to the user. I changed the JS so that the alert message is the last thing to be displayed but it also didn´t help!
I also noticed that if I click Ok on the alert message the test Pass!
If I select other value that dont trigger any JS the test also Pass!
Does anyone have any idea about this issue?
Edit 1:
I noticed another thing, I can use the BrowserWindow object to send a JS script to the browser. If I try to create an alert message the call also gets blocked until I click on the Ok button, on the alert!
BrowserWindow bw = BrowserWindow.Locate("My window");
bw.ExecuteScript("alert('This is just a simple alert.');");
The ExecuteScript statement also gets blocked until I click on the OK button!
This seems very very strange!
I believe I have found a workaround.
I was googling to find anything that could help me with this issue and I end up finding this question on StackOverflow Coded ui test - Select an item from a combobox without using mouse coordinates
I try to select the same item in the Dropdown without using the "SelectedItem" property of the HtmlComboBox element.
I try to use the keyboard to select the element in the dropdown box, first I click on the Dropdown and then I use the Down key and Enter key to select the element that I want:
public void SelectStatus_SP(string SelectedItem)
{
#region Variable Declarations
HtmlComboBox uIStatusComboBox = this.UIHttpsappWindow200.UIpopupUITEDocument5.UIWorkplaceDashboardsFrame.UIpopupUITEDocument.UIStatusComboBox;
#endregion
Mouse.Click(uIStatusComboBox);
Keyboard.SendKeys(uIStatusComboBox, "{Down}{Down}{Enter}", ModifierKeys.None);
}
In my case the element that I want to select is the 3rd one, so I go down 2 times and then hit enter on the element I want to select.
This workaround is not so good because if the element changes position I will select the worng one! But this was the only way I got for the test not to be stock in that part!
I wonder if anyone had a similar issue. Because to me this seems like a bug in the Coded UI Test engine, It doesn´t make any scence for the test to be stocked while the alert is not closed!

Display row wise actions in struts2-jquery-grid-plugin-3.3.3?

How to display rowaction's i..e, edit,delete in every row the grid using struts2-jquery-grid-plugin-3.3.3.Pleas check the image
This issue was resolved.I added jquery.frmtter javascript file and add parameter as actions in gridcolumn.ftl. But this is not implemented in the current version struts2-jquery-grid plugin.Its working for me

mColorPicker error 'Invalid Property value' in IE7

I have recently downloaded mColorPicker.js from here
However, I am running into some issue with this -
When user enters an invalid color value like '#454545xxxx' in the color box, I get a js error - Invalid Property value in IE7 (working fine in Firefox)
error is coming in
jquery-1.4.2.min.js,
line 116 - if(e)f[b]=d
when d = "#454545xxxx"
Also, ColorPicker image is hidden for this textbox.
Any ideas?
The reason this is happening is that the plugin is trying to set the value of the background colour to exactly what the user typed, without doing any validation checking to make sure it is a valid colour. The plugin calls the jQuery .css() method to do this, which is why the error is occurring inside jquery-1.4.2.min.js.
If you are able to modify the plugin code, you can then add checks to make sure the value entered is a valid colour before proceeding.
You might also suggest adding this feature to the plugin author, or, if you get it working successfully, submitting your updated code to them so they can benefit from your work.
I had a quick look, but I don't have the time to properly make the necessary changes to the plugin to ensure it correctly validates the colour is valid in all the right places. Good luck!

Resources