- the speed of the internet connection
- the size of the HTML document
- the size and number of the images inside web document
- some web pages seem to update and load continuously
- sometimes Open Twebst library fails to detect if the page is completely loaded when the page embeds resources like PDF or office documents
To address page loading, Open Twebst has three useful properties: core.loadTimeout, core.searchTimeout and core.loadTimeoutIsError which affect Find methods and work together like this:
- wait a maximum core.loadTimeout milliseconds for the page to be completely loaded. If core.loadTimeout is zero don’t wait and start searching the element right away.
- if the page is completely loaded start searching the element in core.searchTimeout milliseconds. If the element is not found returns null.
- if the page is not completely loaded and core.loadTimeoutIsError is true (which is default value) then throw an exception. If core.loadTimeoutIsError is false try to find the element in core.searchTimeout milliseconds; returns null if not found.
- searchTimeout is useful for elements that are dynamically created by web page scripts + Ajax after the DOM is created.
However it is possible to set core.loadTimeout to zero (don't wait for the page to load) and set core.searchTimeout to a greater value like 1 minute. This way the element is retrieved as soon as it is loaded.
Other related features: core.isLoading, browser.WaitToLoad.
1 comment:
Unable to upload picture and post into FACEBOOK and i have IE 11
Sub OpenTwebstMacro()
Dim core As ICore
Set core = New OpenTwebstLib.core
core.loadTimeout = 0
Dim browser As IBrowser
Set browser = core.StartBrowser("https://www.facebook.com/login.php")
Call browser.FindElement("input text", "id=email").InputText("dasdf")
Call browser.FindElement("input password", "id=pass").InputText("nadfas")
Call browser.FindElement("button", "id=loginbutton").Click
Call browser.FindElement("input file", "id=js_1").InputText("C:\Users\abc\Desktop\FB\Capture.JPG")
Call browser.FindElement("button", "uiname=Post").Click
Call browser.FindElement("a", "id=pageLoginAnchor").Click
Call browser.FindElement("a", "uiname=Log Out").Click
End Sub
Waiting for your reply.
Regards.
Mohammad Shahzaib
Post a Comment