IE ContainsText function crashing scheduler

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

IE ContainsText function crashing scheduler

Post by Tester » Fri Mar 20, 2009 2:58 pm

I am trying to use the ContainsText function to see wether a web page has fully loaded.

If %TagValue% is found, the page is complete.

The problem is that even with a Wait statement, the fuction keeps crashing with the following error message:

Access violation at address xxxxxxxx in module 'IEAuto.dll'. Read of adress 00000000.

When I extend the wait cycles to about 5 it is better, but keeps crashing sooner or later.

It happens with Windows Vista, Windows XP, IE 6 and IE 7.

Any suggestions?


This is the code:

Repeat>%Loop%
Wait>1
IE_ContainsText>%IE[0]%,,%TagValue%,Loop
Until>%Loop%0

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Mar 20, 2009 3:17 pm

I am unable to reproduce any errors with IE_ContainsText. Are you sure you have the correct IE handle IE[0]? What is the value of TagValue?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

Post by Tester » Fri Mar 20, 2009 4:11 pm

I tried something new. If I set a breakpoint and continue the script after it stopped, there is no crash. If I remove the breakpoint, the script crashes!

IE_ClickTag>%IE[0]%,,,IMG,HREF,button.gif,r
IE_Wait>%IE[0]%,r

**BREAKPOINT**

Repeat>%Loop%
Wait>1
IE_ContainsText>%IE[0]%,,sometext,Loop
Until>%Loop%0

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Mar 20, 2009 4:13 pm

Odd. Try a longer delay before IE_ContainsText.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Tester
Junior Coder
Posts: 22
Joined: Fri Mar 20, 2009 2:48 pm

Post by Tester » Fri Mar 20, 2009 4:22 pm

I need a way to continue the script right after the page is fully loaded and displayed.

Neither the IE_Wait nor the IE_ContainsText functions does the trick. I cannot accept to have a wait time up to about 10 seconds to be sure that the page is fully loaded. The script should go FAST through the different pages.

Even with a wait time of about 10 seconds there was a minor chance that the script crashed.

I also do not understand why the IE_ContainsText function must crash when the page is not fully loaded.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Mar 20, 2009 4:25 pm

Nor do I. It doesn't for me in my testing. I've used it on a number of sites and never had a crash. Are you able to give me the URL of the page that causes the crash in your case? If we can replicate we can usually fix.

IE_Wait is needed to ensure the page has loaded before you try to do anything with it. But agree - there should be no need for a specific 10 seconds additional wait.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Mar 20, 2009 4:31 pm

I also do not understand why the IE_ContainsText function must crash when the page is not fully loaded.
Well it shouldn't crash. But if the page isn't fully loaded it won't do anything either. Until the document object is created there's nothing to query. Can you use an application that hasn't fully created it's UI yet?

You MUST wait for a page to load before you can do anything with it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts