Discussion:
how to wait for website?
(too old to reply)
Louis Noser
2022-06-02 07:18:19 UTC
Permalink
Hi

A VBScrict of mine goes to a certain website and fills in fields with
the sendkeys command. Firefox loads the webpage. I've attached the code
I have so far. The tab command sent is just the test if the sendkeys
command works. Up until now, keyboard input has only been possible with
a wait command.

However, the sendkeys command is better off waiting for the web page to
load.

Unfortunately I haven't figured out how to do that yet.

Can someone help?

Many Thanks.
Greetings, Louis
Louis Noser
2022-06-02 07:25:16 UTC
Permalink
...I've attached the code
I have so far.
Here is the code:

Dim url, a
Set url= CreateObject("WScript.Shell")
url.Run
"https://login.raiffeisen.ch/de?Location=https%3A%2F%2Febanking.raiffeisen.ch%2Fapp&webIAMContractNo=3058846EACFB08B56E05B3E9A31DAF5F",
9
WScript.Sleep 10000
Set a = CreateObject("WScript.Shell")
a.SendKeys "{TAB}"
Mayayana
2022-06-02 12:30:14 UTC
Permalink
"Louis Noser" <***@gmx.ch> wrote

| > ...I've attached the code
| > I have so far.
|
| Here is the code:
|
| Dim url, a
| Set url= CreateObject("WScript.Shell")
| url.Run
|
"https://login.raiffeisen.ch/de?Location=https%3A%2F%2Febanking.raiffeisen.ch%2Fapp&webIAMContractNo=3058846EACFB08B56E05B3E9A31DAF5F",
| 9
| WScript.Sleep 10000
| Set a = CreateObject("WScript.Shell")
| a.SendKeys "{TAB}"

The typical approach is to loop until document.readyState = 4.
Then once you get it working you throw out the script
because online banking is a crazy thing to do and automating
it with a script is even crazier. :)
Louis Noser
2022-06-02 13:53:07 UTC
Permalink
Post by Mayayana
The typical approach is to loop until document.readyState = 4.
Tx a lot.

What's the code for that?
Mayayana
2022-06-02 18:43:13 UTC
Permalink
"Louis Noser" <***@gmx.ch> wrote

| > The typical approach is to loop until document.readyState = 4.
|
| What's the code for that?
|
You'll need access to the document object of the web browser.
Then you just do something like:

Do While document.readyState <> 4
a.Sleep 100
Loop

But this gets very involved. If I were to attempt to do
such a thing I'd want to get access to the document object.
For that you access an IE object. Then again, the only
thing crazier than online banking via script would be doing
it with IE. And doing it that way requires expertise
with webpage scripting. I'm not even certain that it's possible.

If you're just shelling then you really don't have any
access to control the details on the page. Unless you're
going to undertake learning all that.... I'm not sure what your
options are, other than to just wait a long time and hope
for the best.
JJ
2022-06-03 10:57:23 UTC
Permalink
Post by Mayayana
For that you access an IE object. Then again, the only
thing crazier than online banking via script would be doing
it with IE. And doing it that way requires expertise
with webpage scripting. I'm not even certain that it's possible.
It's possible. Any program/script which has access to the Shell.Application
object, can peek into the page contents of any MSIE window's active/first
tab (the remaining is inaccessible). Though I can't recall whether it's only
for the active or the first tab.
Mayayana
2022-06-03 17:16:13 UTC
Permalink
"JJ" <***@gmx.com> wrote

| It's possible. Any program/script which has access to the
Shell.Application
| object, can peek into the page contents of any MSIE window's active/first
| tab (the remaining is inaccessible). Though I can't recall whether it's
only
| for the active or the first tab.

Yes. But I didn't want to get his hopes up because
I wasn't so sure how that would work with a page online,
much less banking. I've only done it with webpages local.

I actually wrote a component that can get the document
object of any open instance of IE or an HTA. It uses
ObjectFromLresult in the accessibility library. But again,
I've never tried such shenanigans online.

Loading...