How to get URL of webpage opened in new tab

I am not able to get Current page URL in chrome browser.
What I Want: Wana Get URL Of Webpage Opened In New Tab

What I Tried:-
Using activity “Open browser” I visited on home page of amazon
Click on a button… which open a new tab… I want this page URL.

So using “Get Attribute” I tried to get URL of new page.
And its return last page URL (home page url)

Then What I did next ?
Then I tried “Get Attribute” activity inside “Get Active Window”… and its throw below error
Attribute not supported by the current UiNode

image

@vvaidya

2 Likes

The button action maybe performed by scripting languages like JavaScript. That maybe the reason why it redirects to the homepage itself.

Hi @Tech_Guru

Use attach browser activity to the new tab and try to get attribute, this will work.

Read the question again please. You did not get what I mean @shankm

How to attach the browser ? its select & URL everything is dynamically generated each time. Thats why I need its URL so I can use it inside other activities selectors. @aanandsanraj

@Tech_Guru for dynamic URL Why don’t you add wildcard at the beginning and end like “* www.amazon.in*”

@aanandsanraj
No … wildcard can not be used. Otherwise, selectors will not work. I want to use the URL as a selector in further activities. You should keep in mind that 2 tabs open on same domain name. If I use wild card and copy any text ? How will Uipath will define from which page I should grab the text

Hi @Tech_Guru,
You want the URL which opened in the new tab. Right?

@Tech_Guru Uipath is working based on the browser session, so if new tab opened you have to attach that browser.

If you want that url before clicking the link use get attribute activity to get the url and then click it.

Yes… You get it now

1 Like

Why don’t you try “Get text” activity on the new tab URL bar. @Tech_Guru

1 Like

@Tech_Guru
When you Open the Browser then make use of Output variable of Datatype Browser. Once you want to continue the Work with the Browser you can use this Browser var again by setting IT on the attach Browser properties.

In Case of your scenario is more Tricky then recovering an unknown url for selector should also be retrievable. But lets First try with Browser var approach

Hello @Tech_Guru

Did you already find solution for the question you mentioned? I have the same problem.
Please let know if you figured out how to do it.

I had a similar issue on a web site built with Angular JS and tried below method fix my problem.

  1. After a new tab is opened
  2. Add an Attach Browser activity and do the indicate on browser on the new tab
  3. Open Open in UI Explorer and select url item
  4. Configure selector like “<html app=‘your browser’ title=‘title’ url='https://domain/virtual folder name on the new tab/*”
  5. Add Get Attribute as other masters mentioned in this thread to get the full url.

Hope it helps to fix your problem too.