How can I get the URL of the current active tab?

How can I get the URL of the current active tab? I need it so that I can check by the URL if the current page is the correct one in order to perform certain actions afterwards.

That is what Get tab is for. Add a variable to Result to get current tab, or add a variable to Results to get an array of all tabs. You can also filter by browser by adding chrome or ff to Browser.

Yes, I tried with get tab but it doesn’t return a string. When I use .ToString method on it I only get OpenRPA.Interfaces.NativeMessagingMessageTab.

use autocomplete/intellise or the debugger window, to inspect it.

I’m sorry I am not exactly sure what you mean, I’m not too technical. What I mean is that when I use get tab and save the result to a variable I am then unable to use that variable as a string, it says it’s an object or something, so I tried using .ToString method in order to convert it to a string but instead of the page url the string contained OpenRPA.Interfaces.NativeMessagingMessageTab when I tested it with Type Text and just typed it into google search text box.

Sorry, I could be more informative.

Select the Get Tab activity. Press F9, this will add a red dot on the activity symbolising an breakpoint.
Now press F5 or the run button to run the workflow, once it gets to the breakpoint it will stop, and in the property dialog you will now see all activity variables and the values they have. You tab variable should be null ( i don’t know what you called it so lets assume you called it currenttab )
press F10 to run 1 activity and break.
Now you tab variable currenttab should have an instance of a chrome tab, and you can see all properties on this object, one of them should be .url
This is the one you want, so now you know you should reference currenttab.url

You could also just have added a writeline activity
Then type currenttab. the . will trigger intellisense and you get a list of properties on the object, one of them should be url, so would make sense to use that.

1 Like

Yes, that’s it thank you very much. I just needed to use curenttab.url instead of currenttab.ToString.

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