How to Interact with a Popup Window with Dynamic URL After Clicking a Button

I’m trying to interact with a popup window that appears after clicking a button on another website. The popup does appear, and I was able to confirm its presence using “Check App State.” However, I’m unable to perform any actions like clicking elements within it.

One challenge I’m facing is that the link (URL) of the popup window changes every time it opens, so I can’t target it directly by URL. Since I can’t share screenshots, I’m hoping someone can suggest a reliable way to select and interact with this dynamic popup window.

Has anyone dealt with something similar or has suggestions for handling this kind of case?

@Gowtham924,

Use additional Use Application/Browser activity to highlight that popup.
Inside this activity use your click or any interactive activity.

@Gowtham924

That means your execution pointing to whatever you targeted the application.
now you are getting another new browser so you need to indicate that window by using another Use application/browser activity. or use Navigate to browser activity

Happy automation!!

Hello @Gowtham924 ,

You mentioned that you were able to confirm its presence using “Check App State.” Then use Use Application/Browser activity, indicate the popup, and edit the selector to make it dynamic using wildcards. Inside this scope, add your Click or Send Hotkey activity, whichever works better for you.

Or if this doesn’t work, try to anchor to a unique element inside the popup that stays consistent across sessions.

Thank you for the suggestion! Here’s what I tried based on your instructions:

I utilized the Use Application/Browser activity and indicated the popup. I also edited the selector to make it dynamic using wildcards, even though it behaved differently and opened a different link than expected instead of performing actions on the popup, the link is opening in a new window with the dynamic URL I provided.

For example, my original URL is: gowtham.test.website.in/webPage/pages/main.aspx

And the created dynamic URL (after selecting an option) is: gowtham.test.website.in/task/batch/web1234543IS1223_outputlist.aspx?wg=[DynamicRequestCode]

I’ve ensured the dynamic request code changes as needed, but the issue persists.

Just to clarify- this popup opens in a new window and the URL changes each time, but does the content or structure of the data inside remain consistent every time? Also, could you please confirm if the browser is opening a completely new Chrome instance or just a new tab within the same instance?

If it’s opening a new instance, then “Get Active Window” won’t work reliably. In that case, you can use the “Get Processes” activity with something like “Process.GetProcessesByName(“chrome”)”, then loop through each process using a “For Each” loop. Inside that, use “Attach Window” or “Use Application/Browser”, get the window’s URL or title using “Get Attribute”, and check if it matches expected content (anything diff from your main tab). Once you find the right one, proceed with your interaction.

Also, using “Get Attribute”, you can extract the URL or Title of the new window, store it as a variable, and then use that variable dynamically in all your selectors while interacting with elements in the new window.

Hope this resolves the issues.

the popup does opens in a new window. but not in a whole new instance. it was just a standalone page with minimal UI. I tried to use “Get attribute” but since the URL of new popup window is not mentioned anywhere in the original website and it’s not possible to directly access the URL before opening it.

Thanks for the info! Since the popup doesn’t show any URL and it’s not a new Chrome instance, could you please share a screenshot of the popup window for better clarity? You can still try using “Get Active Window” immediately after the new window opens.

Hi @Gowtham924,

Can you please try to explore the selectors of that pop up using Uiexplorer in studio and share what do you see?

Also is it possible to share the screenshot fo how the pop up looks like? Does this open right on top of the window you are interacting with?

Regards
Sonali

I found the solution—what worked for me was choosing the “Open as: Never” option in the properties and removing the URL.

Thank you to everyone who suggested different ways to tackle the issue—I really appreciate your help!

Also, sorry for not being able to explain the problem more clearly earlier.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.