ToUrl method is only added to
window objects that correspond to WebBrowser controls and to Internet Explorer’s. It loads the page specified by the URL parameter in Internet Explorer, Firefox or WebBrowser control and returns the
Page object that corresponds to the loaded page. You can use the
Exists property to determine if the new page was loaded successfully.
|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
|WaitTime||[in]||Optional||Integer||Default value: -1|
The method is applied to the following object:
To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
The method has the following parameters:
Specifies the URL of the page to be opened in the browser.
If the tested web page is located on your computer, then to make your script computer-independent, use the server name rather than localhost when specifying the page’s URL, that is, for instance, use the URL http://mycomp/path/mypage.htm rather than http://localhost/path/mypage.htm. See Computer-Specific Settings for more information about this.
Specifies the time (in milliseconds) to wait until the browser loads the page and becomes ready to accept user input. If WaitTime is omitted, the timeout is specified by the project's Web page loading timeout option. After the specified time limit is reached, the test execution proceeds.
Page object that corresponds to the newly loaded web page.
If the method navigates to a web page successfully, it posts an event message to the test log.
If the method cannot navigate to a web page, it fails and posts an error message to the test log.
ToUrlmethod is only added to
windowobjects that correspond to WebBrowser controls. This method is an analogue of the
Page.ToUrlmethod. However, it lets you load web pages in a browser without having to obtain the
Pageobject that provides access to web pages.
When recording actions that open a web page, TestComplete automatically transforms them into the appropriate calls to the
ToUrlmethod. However, a method call is not inserted into the test, unless some other actions (mouse clicks, keyboard input, checkpoints, etc.) are performed over the opened page.
ToURLautomatically sets the zoom ratio of the destination page to 100%.
The code below determines whether a page was loaded successfully.
var Page = w.ToUrl("www.MyURL.com");
if (! Page.Exists)
Page = w.ToUrl("www.MyURL.com")
if (not Page.Exists):
Set Page = w.ToUrl("www.MyURL.com")
If Not Page.Exists Then
Page := w.ToUrl('www.MyURL.com');
if not Page.Exists then
var Page = w["ToUrl"]("www.MyURL.com");
if (! Page["Exists"])
Classic Web Testing
ToUrl Method (Browser Objects)
Navigate to Web Pages