This is a migrated thread and some comments may be shown as answers.
Fail to ideitify the new browser opened
2 Answers 22 Views
This is a migrated thread and some comments may be shown as answers.
Mahendra Kumar
Top achievements
Rank 1
Mahendra Kumar asked on 11 Oct 2011, 11:12 PM
Hi,

I have a scenario where I click on a link it opens a new browser which is not a child browser. I am not able to get hold of that new browser opened and webaii does not understands/learns the new browser opened.

I tired using "Manager.SetNewBrowserTracking(true);" but no luck.

sample code :
// to open the new browser
browser.Page.elements.AddLink.Click();
// Track the browser
 Manager.SetNewBrowserTracking(true);
//Click on the Cancel button on new browser opened
browser.newpage.elements.Canclebutton.click();

Getting the below error:
"Test method SandBox.JDSection threw exception:
ErrorHandling.WrongPageException: Method/Property only valid on /admin/add_questions.aspx?
Currently on https://<<Domain>>/display_form.aspx?form_id=649&form_type=1&position_id=1&display_type=preview".

Please suggest some inputs. I am struck at this point.

Thanks & Regards,
Mahendra

2 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 13 Oct 2011, 11:15 AM
Hi Mahendra Kumar,

First you need to enable the new browser tracking, by setting it to true, and than you can perform the click action on the link to open the new browser. When new browser tracking is enabled, any new browser instance launched will be automatically added to the Manager.Browsers[] collection and the ActiveBrowser will be automatically set to the last launched browser instance.  

Try using code similar to the following:
// Track the browser 
Manager.SetNewBrowserTracking(true);
  
// to open the new browser 
browser.Page.elements.AddLink.Click();
  
// Wait for the new browser instance to connect. 
Manager.WaitForNewBrowserConnect("google.com", true, 5000); 
  
//Click on the Cancel button on new browser opened 
browser.newpage.elements.Canclebutton.click();

Please check this documentation article on Handling HTML Pop-ups for more information and let me know if you have any further questions!

All the best,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Plamen
Telerik team
answered on 13 Oct 2011, 11:17 AM
Hi Mahendra Kumar,

Sorry, here is the article:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/advanced-topics/handling-html-popups-and-dialogs/built-in-dialog-handlers/handling-html-popups.aspx

Kind regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Mahendra Kumar
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or