Telerik WebAii Framework - How to change focus to

2019-09-20 02:16发布

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条回答
神经病院院长
2楼-- · 2019-09-20 02:59

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.

查看更多
登录 后发表回答