I would like to obtain elements on my web browser (Chrome) using the IUIAutomation::ElementFromPoint method.
https://learn.microsoft.com/ja-jp/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomation-elementfrompoint
When I call the ElementFromPoint method with the point shown below, I can only get as far as the Chrome window.
But once I've used the Inspect tool, I can get to the deeper elements when I call the same method.
I am hoping to do the same with my tools.
How do you use the ElementFromPoint method to get the deepest web elements?
Before using inspect tool.
After using inspect tool.
Get from point only returns the topmost window around the cursor.
To go lower you have to drill into the components and check that their bounds contain your cursor position (I know, but it’s not as slow as you’d think).
Make sure you’re using either a raw tree view walker or at least a control tree view walker.
Firefox and chrome (and I guess the new edge) require that your code Is signed to drill into web pages (otherwise you could be building something to steal card info etc) - so triple check what your program performs like when used on a machine that it wasn’t developed on , in release mode, and not on an admin account.
Related
I would like to use the Chrome DevTools to determine which tabs are currently visible to the user, that is, tabs that are activated on a non-minimized window. Note that for this use case, I consider windows that are not focused but that otherwise meet the previous criteria as visible.
I have been working through the DevTools API and using the pychrome library to inspect the state of my browser instance and its components. Targets seem like the most relevant part of the API, however, when iterating over the different tabs, I find that for each tab there is always one target that is attached and that I am unable to discern whether or not that target is visible to the user. I have also tried executing the Javascript method document.hasFocus() but this returns false for visible windows that, well, don't have focus.
Is it possible to determine whether or not a tab in Chrome is visible using this API?
I am rather new to using automated testing tools, and as a practical learning exercise, I have been trying to test a small web application using HP UFT 12.02(I updated to 12.51, but am now running into the same issue). The web app was created using the Ionic mobile development framework. I have run into a roadblock and haven't been able to find an answer or similar experience recorded anywhere.
I am not certain whether the problem I have is with UFT, the browser, or with the actual application itself.
I am using IE 11 to test the application. The UFT plugin for Firefox has been disabled at our site, and Chrome is not supposed to be installed on our machines, so I may have some awkward technical constraints.
I've tried recording my actions, and the only success I've had is using the "Insight Recording" mode. In order to make the test readable, I have to do a lot of manual inspection of the objects and renaming. Unfortunately, it seems there is a limitation to what I can select or inspect using UFT's tools.
Using the Object Spy, it seems that I can only select top-level web elements, and for the most part, it seems to work OK. But here is the blocker:
In the app, there is a form that contains a series of pop-up selectors that allow me to select a building, a floor, and a date to reserve a space on that building's floor.
Selector Screen from office reservation application
In IE, if I click the first selector (the Site), nothing happens--regardless of whether I have pop-ups blocked or not. I get the same result performing a manual test on any of those selectors outside of UFT.
If I perform a manual test in Firefox, I get an ion-alert object that contains a series of radio buttons and OK/Cancel
If I inspect the element with Object Spy, I get a "Web Element" that includes the entire contents of the
This includes the form title, all the ion-select elements and labels, etc (way too long to include in this question).
Object Spy view of the site selector object
Is it possible to select an individual element within the form without resorting to x,y coordinates on the screen or window? If so, how? I cannot guarantee who will be running the test in future, nor how their screen or browser dimensions will be set.
Is it possible to change how google chrome views the collapsed form of objects for debugging? I've heard reference to creating functions called toString but I was unable to get them to work, so assumed that those questions were somewhat dated.
I've a legacy app that features a DND from a popup window to the main one.
It works fine in IE 8 but not in any of the newer versions of IE. The effect results in the drag ghost image being stuck in the source window and not going away after the drop had occurred.
Some debugging did in fact confirm that the 'mouseup' event does not get propagated back to the source window. What can be done to fix it? Many thanks!
ITs a bit hard to begin to answer your question without some code....
use the File>Properties menu to find out which IE security zones the two windows(domains) map too...IE uses a different security model to other browsers... drag/drop is probably not allowed between local web files (using file: protocol) and internet or intranet sites.
Have you used the Dev tool yet to debug it? If you are using showModalDialog (which normally disables context menus) you can right click on a link (a) or input element to display the context menu so you can display the debugger for showModal content page.
If possible include a link to your website or a mashup (jsfiddle) with your questions.
When using chrome developer tools, it appears that each app window (and the background 'page') has its own javascript context (space of objects, thread of execution), and yet the createdWindow callback of chrome.app.window.create apparently provides direct access to the objects of the 'other' window that was just created.
Given that, I'm unclear on the best way to communicate between windows; e.g. if I open a second window to act as a dialog box, when the user clicks OK to save changes, should I be using postMessage, sendMessage, or just call a function on an object in the main window. I've looked at the messaging samples, and they seem focused on communication between two different apps, or between an app and an extension.
So, I'm seeking a clear description of the memory and execution model within one app. Are there really separate contexts, or is it just one space of objects, with one thread of execution? What is the best way to communicate between windows of the same chrome app?
That is a great question James!
Multiple chrome windows are not completely separate. They share a single thread and object space, however the window object is different for each. In javascript unscoped references to things are looked up on the current window, so this makes the windows appear to be different object spaces - but they are not really.
So, you can reach into another window and execute a function there, or manipulate state in other ways (e.g. set a variable on another window to a function from the current window) and it is acceptable and supported.
You might find the chrome.app.window.getAll() and chrome.app.window.get() methods useful. They are however new to Chrome 33 which is not yet in the stable channel.
As an alternative you could hold an array of opened AppWindow objects in the background page context.
You can then get a reference to the background page context from any window using the chrome.runtime.getBackgroundPage() method