This is a migrated thread and some comments may be shown as answers.

Get URL new window

1 Answer 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Torch
Top achievements
Rank 1
Torch asked on 25 Jan 2013, 02:46 PM
Browser: Google Chrome v.24

On the page
click on a link that opens in a new window.
Need to get the address of the page that opens in a new window.

Relying on the topic, click on the link using:

Find.ById <HtmlAnchor> ("id_number"). MouseClick ();

However, clicking the link does not occur.

To retrieve and compare URL:
WaitForNewBrowserConnect ("url", false, 1000);

Tell me, please, as well as right-click on the link and then get the URL?

P.S. Translated by Google Translate

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 30 Jan 2013, 10:21 AM
Hello Torch,

Please read this article for a detailed explanation on how to handle HTML Pop-ups. Here is a sample code written against a local HTML file that contains the following link in it:
 
<a href="http://www.bing.com"target="_blank"id="bing">Bing Popup</a>

Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
 
ActiveBrowser.NavigateTo("C:\\Users\\peykov\\Desktop\\popup.html");
 
Manager.SetNewBrowserTracking(true);
 
//Open a new browser window
Find.ById<HtmlAnchor>("bing").MouseClick();
 
Manager.WaitForNewBrowserConnect("http://www.bing.com", true, 5000);
Manager.SetNewBrowserTracking(false);
 
//Write the URL of the new browser in the log
Log.WriteLine(ActiveBrowser.Url);
 
//Check whether the URL contains http://www.bing.com
Assert.IsTrue(ActiveBrowser.Url.Contains("http://www.bing.com"));
 
ActiveBrowser.Close();
 
This short video demonstrates the execution of the code above.

If you are still unable to get this to work, please provide access to your application and I'll be glad to assist you in writing the code. Alternatively you can record and send us a Fiddler trace using FiddlerCap, which is a good substitute for direct access. If you feel that this information is sensitive, you can submit a support ticket which is confidential, unlike this forum.

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Torch
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or