Navigate
PowerScript function
Description
Browses the specified Web page.
Applies to
Syntax
|
1 |
controlname.Navigate ( string url ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the WebBrowser control. |
|
url |
The address of the page to browse. |
Return value
Integer.
Returns 1 if the function succeeds and a negative value if an error occurs.
If any argument’s value is null, the method returns null.
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,
|
1 2 3 4 5 |
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 |
|
1 2 3 4 5 6 |
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,
|
1 2 3 4 |
wb_1.navigate( 'file:///' + ls_temp ) yield() sleep(2) print() |
Examples
This example navigates to the Appeon website:
|
1 2 |
Integer li_rtn li_rtn = wb_1.Navigate("http://www.appeon.com") |
See also