UIATable operation GetCellValue throws error "Failed due to a lacking or broken API call inherited from UI Automation" - ui-automation

I am using the UI Automation add-in to automate and test an application that contains HTML objects in a Java window. I have the UIATable identified & saved in my object repository and the following methods work fine:
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").RowCount 'Prints 3
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").ColumnCount 'Prints 5
However, when I try to get cell value using any of the below methods:
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").GetCellValue(1,1) 'Error
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").GetCellData(1,1) 'Error
MsgBox UIAWindow("**").UIAObject("**").UIATable("**").GetCellName(1,1) 'Error
I get an error pop up with the following message:
The test run cannot continue due to an unrecoverable error.
<0x80070057> Failed due to a lacking or broken API call inherited from
UI Automation.
I am using UFT 14.02. What might be the possible reason for this error and is there something I can do to resolve this?

Have a look at the UFT 14 Product Availability Matrix. You want the section "UFT GUI Testing UI Automation Add-in".
JavaFX is supported but HTML is not supported by the UI Automation Framework in UFT.
That might be why some methods work and others do not. i.e. You can read the java table, but cannot validate the html content.
(I assume you are testing against a javaFX application? - you just say java)
It's worth saying that "Not Supported" doesn't mean it will not work, just that it's not been fully tested and certified by Microfocus.
Additionally, if you check the support pages it has a big note:
Note: The test objects and methods available are completely dependent on the properties and patterns implemented in your application. We recommend that you familiarize yourself with the properties of your application's objects - specifically the Control Type IDs and supported patterns to understand what test objects and methods you can use.
So the error might not be you, and might not be UFT. It might be a result of the delivery of the application under test.
Things you can try...
Try the actual java add-in - it is possible to use multiple add-ins concurrently - even if it's a work around for just one object.
Try the standard windows object identifiers.
Confirm the application is built to support Microsoft's UI Automation
Update to the latest UFT (UFT 15.01 at time of writing, now also called UFT One) to make sure your libraries are as up to date as possible
If all that fails let me know. UFT is very flexible around the GUI and depending on how you need to interact with the table there are some other solutions we can try.

Related

Use openapi service in Flutter Drive integration test, but run into dart:ui problem

The app I am trying to test makes use of feature toggles to enable/disable certain parts of the app. However, the tests I've written are for all the features. When a user logs in, this will fetch the feature toggles from a REST service (using a class which uses the generated openapi) so the app knows what to show and what not to show.
Now I want to include those feature toggles in my tests, so that the corresponding tests are skipped and don't just fail if some parts aren't enabled. However, when I try to include the class that does the call, I get problems with dart:ui in the console, and the test no longer runs. When I (recursively) check the imports on those service classes, there are some imports to widgets.dart, so I guess that's the problem. I tried removing most of it, but since we're using Localized strings for error messages etc. it's getting to be a very cumbersome job to remove all of that from those files.
So before I continue doing that, I was wondering if there is any easy way to include a call to a REST service in an integration test?
I checked the Flutter drive documentation, and searched for some similar questions online but haven't really found anything similar.

Is there a way to retrieve information from a ui element that has the property IsControlElement = False? (Python + Appium + WinAppDriver)

Greetings and salutations!
I'm working on a UI automation project for a windows desktop app (FrameworkId: Win32)
Stack: Python (3.7) + Appium (1.15.1) + WinAppDriver (v1.1).
I have identified an element using Inspect.exe, but when I try to code, whatever I do I receive this error:
selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.
The locator strategy I'm using is xpath:
self.driver.find_element_by_xpath("//*[#LocalizedControlType='text' and #IsControlElement='false']")
As you can see, Inspect.exe has shown that it has the property "IsControlElement='false'", but I cannot for the life of me "access" it via code.
I would also like to point out that any elements that had the IsControlElement='true' are properly found and I can "interact" with them.
Thank you very much for your help!
Source of issue
This is probably an issue within Microsoft's UI Automation implementation in .NET.
The property IsControlElement should have returned true while it didn't.
From my tests, it seems to be an issue somewhere within UIAutomationCore.dll.
I speculate that the root cause is that the automation implementation was targeted for accessibility in mind, and they have mistakenly ignored some controls which are NOT readable (Image, Geometry, etc.).
Workaround for some cases
Try to use UI control from a type that has a text.
if it's already a textual control, try to use a different textual control type. for example - in WPF project - use Label instead of TextBlock
if it's NOT a textual element, if possible, wrap the control in a textual element. in WPF projects you can use a <Label Padding="0"> as a wrapper.
Other things to consider
Try to use UIAComWrapper
Related issues
https://stackoverflow.com/a/46452431/426315
UIAutomation won't retrieve children of an element
UI Automation - #32770 (Dialog) shows in Insepct.exe but not in VisualUIAVerifyNative.exe
Side Note
Since you haven't specified which Python GUI library are you using, I was not able to provide examples for your library. Sorry.

SAPUI5 chart not visible...when running from within the portal

I have a really bizarre one here...I have developed and deployed to my back end system a launchpad application that currently works OK. Part of this application is a report that, based on certain filters, returns a table and a chart (see snapshot below).
After finishing deployment next step is configuring the app so it runs from the launchpad within the SAP portal. Not familiar with the portal, another colleague undertook the task, application is now running from within the portal as well. With one exception - the chart above is not visible (see 2nd snapshot below).
Noticing the "No Data" message and NO exception in the Chrome debugger, thought as a good idea to debug the OData methods in the back end. To my big surprise, found out that while filters pass to the method just fine both for table and chart (two different entities but almost identical and accepting exactly the same parameters) when running outside portal, when running from within (the portal) parameters "get lost" on their way to the chart entity - no parameters for the chart method. See snapshots below and pay attention to the IT_FILTER_SELECT_OPTIONS at the bottom right.
Outside portal (parameter table filled)
Within Portal (parameter table empty)
Furthermore, the filter table passed to both OData tables is common, you can see the code underneath - just two lines: one for table and one for chart binding.
Closing with a clarification. Mentioned above that there are no errors in the debugger when calling the back end methods. There are actually a couple of them but they take place during the initialization of the app and do not seem to affect anything else in the app, which aside a set of reports has a lot of data operations (dialogs, tables etc), everything else works fine. These errors can be seen below.
Does this situation ring any bells to anyone?
Thanks in advance
Issue solved, it was a deployment issue...

Why WebIde shows error for alert and console.log?

I am using WebIde of SAPUI5 development.
If I write a console.log or alert it shows error of unexpected Alert and so on inside of the editor.
While the code works and I prefer to not see these errors inside of the editor.
How can I customize WebIde to not show these kind of errors.
While it is discouraged to use console.log and alert statements in your code because
[...] such messages are considered to be for debugging purposes and therefore not suitable to ship to the client [...]
http://eslint.org/docs/rules/no-console
and
[...] JavaScripts’ alert, confirm, and prompt functions are widely considered to be obtrusive as UI elements and should be replaced by a more appropriate custom UI implementation [...]
http://eslint.org/docs/rules/no-alert
you can have your Linter configured to bypass these checks (although I would not recommend to do so)
But keep in mind these checks are not specific to SAPUI5 or Web IDE, rather for every Javascript project!
Anyway, since Web IDE uses ESLint, to disable the check, add the following on top of the affected Javascript file:
/*eslint-disable no-console, no-alert */

how can I improve iPhone UI Automation?

I was googling a lot in order to find a solution for my problems with UI Automation. I found a post that nice summarizes the issues:
There's no way to run tests from the command line.(...)
There's no way to set up or reset state. (...)
Part of the previous problem is that UI Automation has no concept of discrete tests. (...)
There's no way to programmatically retrieve the results of the test run. (...)
source: https://content.pivotal.io/blog/iphone-ui-automation-tests-a-decent-start
Problem no. 3 can be solved with jasmine (https://github.com/pivotal/jasmine-iphone)
How about other problems? Have there been any improvements introduced since that post (July 20, 2010)?
And one more problem: is it true that the only existing method for selecting a particular UI element is adding an accessibility label in the application source code?
While UI Automation has improved since that post was made, the improvements that I've seen have all been related to reliability rather than new functionality.
He brings up good points about some of the issues with using UI Automation for more serious testing. If you read the comments later on, there's a significant amount of discussion about ways to address these issues.
The topic of running tests from the command line is discussed in this question, where a potential solution is hinted at in the Apple Developer Forums. I've not tried this myself.
You can export the results of a test after it is run, which you could parse offline.
Finally, in regards to your last question, you can address UI elements without assigning them an accessibility label. Many common UIKit controls are accessible by default, so you can already target them by name. Otherwise, you can pick out views from their location in the display hierarchy, like in the following example:
var tableView = mainWindow.tableViews()[0];
As always, if there's something missing from the UI Automation tool that is important to you, file an enhancement request so that it might find its way into the next version of the SDK.
Have you tried IMAT? https://code.intuit.com/sf/sfmain/do/viewProject/projects.ginsu . It uses the native javascript sdk that Apple provides and can be triggered via command line or Instruments.
In response to each of your questions:
There's no way to run tests from the command line.(...)
Apple now provides this. With IMAT, you can kick off tests via command line or via Instruments. Before Apple provided the command line interface, we were using AppleScript to bring up Instruments and then kick off the tests - nasty.
There's no way to set up or reset state. (...)
Check out this state diagram: https://code.intuit.com/sf/wiki/do/viewPage/projects.ginsu/wiki/RecoveringFromTestFailures
Part of the previous problem is that UI Automation has no concept of discrete tests. (...)
Agreed. Both IMAT and tuneup.js (https://github.com/alexvollmer/tuneup_js#readme) allow for this.
There's no way to programmatically retrieve the results of the test run. (...)
Reading the trailing plist file is not trivial. IMAT provides a jUnit like report after a test run by reading the plist file and this is picked up by my CI Tool (Teamcity, Jenkins, CruiseControl)
Check out http://lemonjar.com/blog/?p=69
It talks about how to run UIA from the command line
Try to check the element hierarchy, the table can be placed over a UIScrollView.
var tableV = mainWindowTarget.scrollViews()[0].tableViews()[0].scrollToElementWithName("Name of element inside the cell");
the above script will work even the element is in 12th cell(but the name should be exactly the same as mentioned inside the cell)