问题
Testing using WebAii Framewok - I am currently stuck at a point where I'm not able to determine which window my code is focused on. The code opens a page lest say A, clicks on a link which then opens a new child window, call it B. How do I access page/window B? How do I click a link on page B?
Your help is much apprciated.
Thanks, dot net newbie
回答1:
You can connect to a new window by using the call Manager.WaitForNewBrowserConnect() followed by Manager.ActiveBrowser.WaitUntilReady(). The first method takes three parameters: a string for the URL to connect to with the new window, a boolean setting whether or not to use partial URL matching, and a timeout.
You'll be connected to the new window. From that point on you continue with your steps as usual.
For example, on a demo app I have I use a coded step with:
Manager.WaitForNewBrowserConnect("http://localhost:3000/contacts/16/edit", true, 5000); Manager.ActiveBrowser.WaitUntilReady();
Subsequent steps work just like normal.
来源:https://stackoverflow.com/questions/7844050/telerik-webaii-framework-how-to-change-focus-to-newy-opened-page-window