Can not select an item from WinList in codedui - coded-ui-tests

I am doing automation for a desktop winform application and I want to select from a combobox , I dont know why but is recognized as a WinList instead of a standard combobox. codedui opens the list by clicking the button near it but can not select an item, getting error for it.
Here is the recorded code for the UI element
WinButton uIOpenButton = this.UIProMANAGEWindow.UIProductionReportWindow.UICbReportComboBox.UIOpenButton;
WinList uIItemList = this.UIItemWindow.UIItemClient.UIItemList;
#endregion
// Click 'Open' button
Mouse.Click(uIOpenButton, new Point(9, 9));
// Select '' in list box
uIItemList.SelectedItemsAsString = this.URFSelectReportParams.UIItemListSelectedItemsAsString;
Here is the exception I am getting
Message: Test method CodedUITestProject2.Raporlar_URF1.CodedUITestMethod1 threw exception: Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnBlockedControlException: Another control is blocking the control. Please make the blocked control visible and retry the action. Additional Details: TechnologyName: 'MSAA'ControlType: 'List' ---> System.Runtime.InteropServices.COMException: HRESULT özel durum döndürdü: 0xF004F003

After the WinList opens ,you need to check the properties of the control that opens. It might most certainly be Wincustom and in it there would be WinListItem.
You have to create these controls and then click the Winlistitem you want using Mouse.Click().

Related

Test quickly changing scenario using selenium web driver in nodejs

I have a button which triggers a rest call and upon click of that button until the rest call triggers I disable the button.
I am writing a test case using selenium web driver and nodejs
button = driver.findElement(By.class("btn"));
await button.click();
console.log(await button.isEnabled()) //outputs true
But I can see that the button is being disabled and I am sure Iam selectingthe correct button the findElement statement.
The documentation for .isEnabled() says:
Is the element currently enabled or not? This will generally return true for everything but disabled input elements.
So what you are seeing is expected behaviour.
To test your scenario, you will need the following approach:
click your button
click the same button again
the second click you are expecting to fail, so you will have to wrap it in whatever is the node.js equivalent of try..catch (sorry, I'm a Java guy)
inside of the catch, set a variable to true
afterwards test the variable has been set
The scenario you have described is to click a button, verify it becomes disabled, and then verify it becomes enabled. There are probably a few ways to do this. I'm looking at the documentation and here is one way:
button = driver.findElement(By.class("btn"));
button.click();
driver.wait(until.elementIsDisabled(button));
driver.wait(until.elementIsEnabled(button));
If the button never becomes disabled, an exception will be thrown. If the button never becomes reenabled, an exception will be thrown. So, the fail condition is either one throwing an exception. The pass condition is no exceptions.
NOTE: disabled and enabled, in Selenium terms, is generally referring to an INPUT tag. If your button is not an INPUT tag, then this won't work. You will need to detect some CSS style being applied/removed to determine disabled/enabled.

Why does my error message display quickly, then disappear right away

I have a save button on my xpage. I have field edits inside of the button. I did that because when I put the edit in the field validation, it runs when I open a new xpage. Either way though, I have an Error Message control on the form. When I click the save button, it flashes yellow then disappears. Why is this occurring? It's simple code:
if(getComponent("ExpAmt").getValue() == null) {
#WarningMessage("You must enter an Amount for this expense");
return false;
}
Partial refresh message box displays saying:
An error occurred while updating some of the page.
Unable to load http://localhost/DB.nsf/xpForm.xsp?$$ajaxid=view%3A_id1%3A_id3%3A_id4%3ApanelAll status: 0
There is a partial refresh in your ccApplicationLayout that runs onClientLoad. It was immediately refreshing the panel after the page was loaded which caused the flashing effect. Removing this solved the issue.

coded ui the controls become blocked (hidden) after new page loads

The controls in the page become blocked (hidden) after the new page loads. Error message :
Test method GUIAutomation.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control.
The root cause of this issue is: coded UI store the previous parameters of the window. When appeared the new window. Coded UI must have new search criteria for this new window. If the window have the same of search criteria. You must create the new instance of the window in coded UI.
Example:
SystemMessagePage message = new SystemMessagePage();
message.CloseExistMessage(); \\Close system message
If appeared the new system message window, we can't close this window by call of the method message.CloseExistMessage();.
To close a new system message window we must create a new instance of the window and repeat the previous code.
SystemMessagePage message = new SystemMessagePage();
message.CloseExistMessage(); \\Close system message

ZK: Modal window not working properly when exception is thrown

The problem I have is pictured in this fiddle I created:
If you click on the Order coffee button, I've forced a Runtime Exception to be thrown within the doAfterCompose method of the modal window's controller. As you can see the modal window gets appended at the bottom of the page. This, aside from being ugly, allows the user to click again the Order Cofee button, which causes the famous "Not unique ID in space" error.
Is there any way to prevent the window from being created when an Exception is thrown?
You can call setPage(null) method on your component.

How to identify a button click in coded UI Customised code

In UIMAP.CS file in both the Recorded method and assertion method, I am not able to identify the button click.
Is there any way I can get hold of the button click event?
I am able to get hold the button in to a UITESTCONTROL variable but the options I was able to see are "exists", "enabled","name" etc...
I tried checking it with assertions too when I dragged the cross hair on to the clicked button , assertions are generated only for checking the existence,correctness of text and name but not the events occured on it..
Please help in this regard..
Please make sure that the Control/Object on which you want to use the Click operation is a button and not any Web Element or control which does not support the Click operation.
Once verified, you can do the following:
Record a New Session and while recording click on that button, stop your recording.
Open the UIMap.cs and navigate to that button control. The intellitrace would show you all the available options for that control.
Thanks
Nikhil

Resources