Description
Browses the specified Web page.
Applies to
Syntax
controlname.Navigate ( string url )
Argument |
Description |
---|---|
controlname |
The name of the WebBrowser control. |
url |
The address of the page to browse. |
Return value
Integer.
-
1 -- Success.
-
-1 -- General error.
-
-2 -- Failed to get the browser instance.
-
-5 -- Invalid URL.
Usage
The Navigate function is executed asynchronously. Therefore, if the next script must be executed after the Navigate function is completed, then it is recommended to check the value of the NavigationProgressIndex event, and only after the event receives the value of 100 (which means the page is 100% loaded), the next script should be executed. For example,
String ls_temp ls_temp = "D:/PB/PB2019R3/WebBrowser/JavaScript/ManuTestCase/html/JavaScript_011.html" wb_1.navigate( 'file:///' + ls_temp ) ib_init = false //Instance Variables: Boolean ib_init
If Not ib_init Then If progressindex = 100 Then ib_init = true print() End If End If
But if the page to be loaded is complicated (such as loading multiple frames, embedding large amount of data, associating and accessing data from other websites, having complex logics or deep hierarchical structure etc.), the value of 100 may not indicate that the page is completely loaded. In such case, you can consider using Yield and Sleep functions to delay executing the next script. For example,
wb_1.navigate( 'file:///' + ls_temp ) yield() sleep(2) print()
Examples
This example navigates to the Appeon website:
Integer li_rtn li_rtn = wb_1.Navigate("http://www.appeon.com")
See also