Hi there,
I know I'm late to this party. I really like the software and it looks perfect for my needs. I'm hoping some support might still be available.
I'm trying to automate an IE button click using Open Twebst through VBA in Microsoft Access, which works absolutely fine if the button exists. If the button doesn't exist, VBA throws an error. My attempts to detect whether or not the button exists before trying to click it, also throw an error.
Here is the code I'm using (which I got from the macro recorder:)
Dim core As ICore
Set core = New OpenTwebstLib.core
Dim browser As IBrowser
Set browser = core.StartBrowser("
http://www.example.com/")
Call browser.FindElement("input button", "id=EXAMPLE").Click
This works totally fine as long as the button exists.
But if it cannot be found, I get error 91 "Object variable or with block variable not set."
I read in the documentation for FindElement that if Core.loadTimeoutIsError = False, then it should be possible for FindElement to return a null value.
But I cannot even find any way to read the value of FindElement.
Debug.print browser.FindElement("input button", "id=EXAMPLE") returns the same error 91.
Any ideas on what I might be doing wrong? If it's possible to post up an example of how to simply check if an element exists in VBA code, that would be extremely useful.
Many thanks in advance.