I have captured some UI elements from a web page. That web page has a specific URL, of the form (in my case) of:
https://myurl.com/mycompany/application/home
This web page and its elements are specific to that URL. However, the elements are generic to all of the pages, not just /home (things like menu expand, menu contract, search, add buttons). And even the elements are generic to all companies, not just the one named mycompany. So, I need to make this more generic - either find a way to use an asterisk in place of mycompany or home. Worst case, I have the company name in a variable. However, in PAD, I see no way to edit the web page address of a UI element - only the things in the dom that define the element.
Is there any way to do this?
Solved! Go to Solution.
The URL of the website from which you capture the element does not affect the selector of the web element.
If the element is let's say under "html > div ... > div > a" in website A, and you switch websites, that selector will target the corresponding element in website B under that same path.
Can you show an image of one of your selectors?
Have you tried editing the main container of the UI Elements?
From the UI elements list:
If I double-click on the Web Page item, I get this:
The URL here is the one I need to make generic, so I can trigger the Menu Expand on any page, for instance. I assume I could add a second selector with different company name, but there could be hundreds of companies. So I added a second selector, which just says Web Page with no URL listed. Maybe then I could make it the default and delete the original one?
Oh if you just have a container selector thats something like desktop > dormcontainer, then I'm fairly certain you just need to make the selectors in the container more generic i.e. not use the first few selector boxes that include the URL rather than bother with the actual container URL, as it doesn't care for the URL, its just using the browser instance.
If that's not the case, give me some example websites that I can take a look at and I'll get back to you about it.
When I do the initial capture of the web page element, it adds the URL to the web page portion of the element. So, that element won't work if shown on another page. But if I then capture a second selector for that web page, it does not add the URL. So, I just capture the second selector, and disable the original selector. Then it seems like it can find the element even on multiple pages. I'm still playing with it, so when 100% sure, I'll annotate this post and close it.
Can you share the full selector builder window?
This was the original window selector. Note that it includes a URL. I then added a second capture, which only says Web Page...
If I disable the original window selector and add the generic Web Page, PAD can find the UI elements no matter what the URL is. Since the URL changes based on which company I am dealing with, I need this generic ability.
Note that this has nothing to do with the element part of the UI element - only the window part.
You are editing a Web Page element. These should never* be opened.
You can move your UI elements between your pages by dragging on the three-dot menu. The name of the Web Page element never has any technical function - it is only a name.
*There might be some circumstance that I am not aware of...
The name is not the issue. The issue is: When you first capture a web UI element, it includes the web page URL in the window descriptor. So, elements captured on this page will not work on another page with a different URL, even though they are the same in the DOM. That's because the window descriptor is linked to the URL. Since this URL cannot be edited, the only workaround I've found is to capture a second selector, which does not get the URL, and deactivate the original selector that has the URL.
Which window descriptor?
The URL of the website from which you capture the element does not affect the selector of the web element.
If the element is let's say under "html > div ... > div > a" in website A, and you switch websites, that selector will target the corresponding element in website B under that same path.
Ah, that would explain it. In every automation system I've used, a UI component consists of both the window and the component within the window. In PAD, the window portion is ignored, and instead the browser window coming back from the launch/attach action is used. When I call to attach the browser, I use a generic partial URL, so it will find it no matter what the latter portion of the URL is. Thanks for pointing that out - had not seen that documented anywhere.