I am trying to the get the current Url of the active page and tried this. But in the Log View i am not able to see the URL. As after fetching the URL I need to split the URL.
var URL = this.ActiveBrowser.Url.ToString();
Log.WriteLine(URL);
And tried this too string url1 = Manager.ActiveBrowser.Url.ToString(); but the same issue appears that it does not return URL in the Log.
Thanks
Dipti Mukhija
0
Elena
Telerik team
answered on 07 Nov 2019, 10:18 AM
Hi Dipti,
I am sorry to know you faced such inconsistent behavior and will be happy to assist you with that.
Based on the execution log you shared, it looks like the current active browser does not have a URL and the actual output in the log is an empty string. To check if anything will be output in the log, you can add some text along with the URL, e.g.
var URL = this.ActiveBrowser.Url.ToString();
Log.WriteLine("the current URL is: " + URL);
If the additional text is written in the execution log, we need to focus on the browser and URL. To be sure that the approach is actually working, you can use a sample test to navigate to any public accessible page and output its URL. What the outcome will be? I tested this on my end as well and it works as expected.
If it turns out that the sample test works, then the issue seems to be related to the specific application or the scenario itself.
Can you, please, elaborate further details on the application and the requirements? Is that page to take its URL a popup? Is there anything else specific in this one. What is the approach used in the test to accomplish your needs?
During the test run, where is the focus? is there any action before getting the URL, that might be changing the focus?
If these additional notes are not helping you to find what might be going wrong, please share the test script via this thread - even if I cannot access the page, going through the steps may help me find out what is going wrong.
Thank you in advance for your cooperation. I am looking forward to hearing back from you.