Silk Mobile

Table of Contents (Homepage)

HybridWaitForPageLoad

hybridWaitForPageLoad (time)

images/images/os-icons/os_ios_150x150.png

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

Description

Waits for a web page to load in a given time-out in milliseconds

Note: In hybrid applications - will wait for the web part of the application to load.

Parameters

  • Time: The time to sleep in milliseconds

Usage

Scenario: In the following example we will use the 'HybridWaitForPageLoad' to wait for the following web page – http://www.amazon.com to load.

Command usage: ‘HybridWaitForPageLoad‘ will wait and not proceed to the next step until the web page load is finished, It is recommended to use this command when loading new web pages.

Parameters:

  • Timeout: The time we will wait for the page to load in milliseconds – will be set to the default value – 10000.

Step 1: Launch http://www.amazon.com.

Note: The web page is not fully loaded after the command ends.

images/download/attachments/3310092/3.jpg

Step 2: Before moving to the next step, we will use the ' HybridWaitForPageLoad ' command to make sure that the page is fully loaded.

images/download/attachments/3310092/4.jpg

images/download/attachments/3310092/5.jpg

Code Examples

Java Example
client.setDevice("adb:Nexus5");
client.launch("chrome:http://www.amazon.com", true, false);
client.hybridWaitForPageLoad(10000);
// Now we can move to next steps on the web page....
C# Example
client.SetDevice("adb:Nexus5");
client.Launch("chrome:http://www.amazon.com", true, false);
client.HybridWaitForPageLoad(10000);
// Now we can move to next steps on the web page....
VBScript Example
client.SetDevice "adb:Nexus5"
Report
client.Launch "chrome:http://www.amazon.com", true, false
Report
client.HybridWaitForPageLoad 10000
Report
Python Example
self.client.setDevice("adb:Nexus5")
self.client.launch("chrome:http://www.amazon.com", True, False)
self.client.hybridWaitForPageLoad(10000)
# Now we can move to next steps on the web page....
Perl Example
$client->setDevice("adb:Nexus5");
$client->launch("chrome:http://www.amazon.com", 1, 0);
$client->hybridWaitForPageLoad(10000);
# Now we can move to next steps on the web page....