Menu
Web views are a problem. AppiumForMac runs in its own process. It doesn't have direct access to web views inside another application. This means no direct JavaScript injection, no running scripts, and most importantly, no way to find elements using a DOM Xpath, such as you might use for ChromeDriver or SafariDriver. You also can't locate elements by CSS class, for example. You just can't get there from here.The news is not entirely bleak.
![]()
How to install Appium on MAC OS (2019 Update) with all external tools and components. I will try to explain each step respectively.
The OS X accessibility APIs do allow access to the visible UI elements inside web views. You have to use accessibility XPaths instead of DOM XPaths. (What is an accessibility XPath? See the newest version of appium-for-mac for details). So you can see and manipulate the web view like any native UI elements, but you still can't inject JavaScript and do other things that require direct access.It is possible (but difficult) to take AppiumForMac and essentially paste the code into your own application, thereby giving the handlers direct access to the entire application, including web views.
I don't recommend this approach, but if you've got the time. Also, beware that the PFAssistive.framework is freely licensed ONLY inside AppiumForMac.app.
If you copy the code into your own app, you need to contact PFiddleSoft and acquire a separate license. They're not expensive and you will not regret the amazing documentation of the framework, and excellent support.Maybe one day someone will re-package AppiumForMac as some sort of framework that can be easily dropped into any application. I've heard rumors about such things, but haven't seen one in public. There may also be licensing issues with this approach. The answer is yes, and no, depending on how you want to automate your web views.AfM is a stand-alone application. It uses macOS accessibility API's to examine and control the macOS UI (including applications under test).
![]() ![]()
As a separate app, it has no way to go into the AUT and directly access objects such as a web view. As such, it can not use normal web view XPaths. These can only be used from inside the AUT, because accessing them requires DOM methods which are not exposed by the accessibility APIs.However, the accessibility APIs do provide accessibility-based paths for some web view elements, just like accessibility paths for native macOS controls.
They are not standard DOM paths. I call them 'AXPaths' because at every level the classes and attributes begin with 'AX.' The Accessibility Inspector application shows these attributes.So if you are willing to use AXPaths, the answer is Yes. To find an AXPath for any element (web view or native) just run AfM, point to an element on screen, and press the function (fn) key. In a second or two you will see the AfM dock icon bounce and you can release the fn key. Your clipboard will contain the full path.If you must use standard DOM xpaths, then the answer is No, AfM can not help you.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |