Finding elements by xpath in Appium using XCUITEST driver - xpath

The task of updating an automation framework has fallen upon me. I'm new to iOS testing so I'm having trouble with the new XCUITEST driver in Appium-1.6.0-beta1.
I have the driver up and running, but the majority of elements are located using xpaths in the framework (not at all ideal I know) the majority of elements do not have labels, names, or accessibility tags. Thus :name locators are ruled out for 90% of elements at the moment.
The xpaths seem to be catering to the old apple framework (UIAutomation) and look like the following:
//UIAApplication[1]/UIAWindow[4]/UIAAlert[1]
I have tried soemthing like this:
//XCUIApplication[1]/XCUIElementTypeWindow[4]/XCUIElementTypeAlert[1]
These are passed into driver.find_element(:xpath, xpath_value) With no luck. I can't seem to find any documentation on this, and have had minimal success on the appium discussion forum.
Can anyone point me to a working example, or documentation? Any better way to do this?
Any input would really help!
Thanks,
Peter

Not all of the XCUI elements are direct transfers from UIAutomator. The way I have been using is to run the tests without the xpaths you need and when you open onto the screen you desire go:
System.out.println(driver.getPageSource());
Then it is a matter of reading that XML to get the desired item. A lot more tedious but without the appium inspector in 1.6BetaX it's the only way I know how to get the XCUI hierarchy.

With little workaround, you can use the old graphical appium to find xpath of view elements for using with Appium v1.6 Follow the step 1 in this link on medium:
The good old Appium inspector, with a bit workaround

The above answer by JaysonP works fine but there still is a way to use the appium inspector.
Run appium you are using (appium 1.6.x ) from terminal/command line
Open appium GUI application but Do NOT run it
In the GUI, give the App Path
Make sure both the GUI version and the one you are running on terminal are using the same port. Once again DO NOT launch appium from the GUI
Click the Inspector button without launching appium
Inspector window should be opened and you can use the way you have been using it previously

Related

Not able to click on AXImage

I am working on a Xamarin.Mac Application. Where I want to click an image using Appium test automation.
The driver doesn't seem to be able to click on an AXImage. Is there any known workarounds for clicking on them?
Added the capabilty MobileCapabilityType.FORCE_MJSONWP as true and it worked for me. This is a work around in java client.
[W3C] Does not support sending keys to active element for Mac

What are the ways or tools available to inspect element in a Mac desktop application

We have firebug or chropath or inspect element methods to find locators of a web application. Similarly, how to identify element of a Mac desktop application (for example, iTunes desktop app)?
Thanks in advance.
Use Accessibility Inspector,just type in Inspector in the spotlight. So far, its able to get class, text and labels, but not well recognize using it with Appium. I am hoping for a better more accurate tool.
You can use pyatom (python library for automated testing on MAC).
PyAtom is Python library to fully enable GUI testing of Mac applications via the Apple Accessibility API.
Github link - https://github.com/pyatom/pyatom

Electron prompt support

I am looking for a native (OS X) prompt module when working on Electron, something like the window popped up when I click 'Join Other Network...':
This offers the ability to get inputs and process the data returned. So Dialog in Electron may not work here (at least I did not figure it out). I found this issue, but I cannot understand it.
Right now my approach is to open up a browserWindow to to ipc with main thread, but the most critical issue is that, it does not feel like native!
Any help is appreciated!
Electron currently does not have this functionality built in. As far as I know this UI is fully custom, the OS API does not have a direct way to create this UI. For this reason it is likely Electron will never have this functionality.
Your only options are to mimic the native UI in CSS or create a node module that accesses the OS APIs to build your desired UI.

Selenium: Firefox showing different behavior when launched by Selenium

Note - App coded in Extjs
Certain ExtJs elements or parts of elements (like titles) are not appearing or loading when using the selenium launched FF.
Things I tried
Going to the same page with a manually launched firefox - works
Stopping the test after login to use the launched version and going
to the same with issues - still see issues
Updated to latest version of FF - same issues.
Is there anything with the Firefox driver in selenium that could be causing these discrepancies?
To add to to the situation I can actually get the store behind the grid that isn't loading up
The thing is ExtJS is using a really annoying HTML5 features, which need a bit more then simple simulations of user interactions. For ecample an element could be with no childs, but when you will click on it, it will automatically load all of it's childs. That's why you don't see all the elements.
For that purposes, if you are using java you should use http://html5robot.com or similar things, which are developed to help Webdriver interact with complex HTML5 solutions.

Detecting Full screen applications on mac

I am developing a simple application in Cocoa, and I want to detect whether any application is running in full screen mode. Is this possible?
Through runningApplications API, I can get various informations but there is no specific property related to full screen mode. Does any one know how to detect it? Is there any carbon event or API for this?
I ran into this in the spring and spent forever trying to get it to work. I ended up packaging my code up into a little GitHub project, but I completely forgot to share it here.
https://github.com/shinypb/FullScreenDetector
Hope this is useful for someone.
Anyways after trying out so many options and digging into the NSWorkspace i have found way through which we can achieve this their is notification
"NSWorkspaceActiveSpaceDidChangeNotification"
Apple doc says "Posted when a Spaces change has occurred." so by using we can register for it. along with this we need to use the NSWindow's property "isOnActiveSpace" , so by this we can detect when application enters full screen mode and exits from it.
You want to key-value observe -[NSApplication currentSystemPresentationOptions]. When the active app is in full-screen mode, that property will include NSApplicationPresentationFullScreen.

Resources