IE_ContainsText

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rscarr
Newbie
Posts: 4
Joined: Wed Nov 19, 2008 12:05 am

IE_ContainsText

Post by rscarr » Sun Feb 01, 2009 11:42 pm

I need to determine if text ("mform29") exists in an IE Window. Looking at the source I see it. For the life of me I cannot get it to work so I built a test bed to open a window and find the letter "a" also without success. Here's the code:

[code]
MouseMove>0,0
IE_Create>0,IE[0]

IE_Navigate>%IE[0]%,gallerygolf.com,r
IE_Wait>%IE[0]%,r

let>exists=0
IE_ContainsText>IE[0],,a,exists
IF>{(%exists%=1)}
Let>delay=1
else
Let>delay=2
endif

Exit>1
[/code]

What am I not doing please?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Feb 02, 2009 12:27 am

I'm not familiar with IE_ContainsText> but try the If> like this:

Code: Select all

IF>exists=1
If IE_ContainsText> returns the number of instances maybe you need >0 not =1?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Feb 02, 2009 3:42 am

What are the symptoms of not working?

Single step through the script, are the values correct?
What is the value of %exists% before the IF line?

Try this line without the ">":
IF exists=1
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

rscarr
Newbie
Posts: 4
Joined: Wed Nov 19, 2008 12:05 am

ContainsText

Post by rscarr » Mon Feb 02, 2009 3:00 pm

[quote="Me_again"]I'm not familiar with IE_ContainsText> but try the If> like this:

[code]
IF>exists=1
[/code]

If IE_ContainsText> returns the number of instances maybe you need >0 not =1?[/quote]

It's supposed to return 1 if it gets a hit. Tried the IF change. No joy. Thanks

rscarr
Newbie
Posts: 4
Joined: Wed Nov 19, 2008 12:05 am

ContainsText

Post by rscarr » Mon Feb 02, 2009 3:04 pm

[quote="Bob Hansen"]What are the symptoms of not working?

Single step through the script, are the values correct?
What is the value of %exists% before the IF line?

Try this line without the ">":
IF exists=1[/quote]

I set exists to zero b4. After it's zero. Tried the IF change. The code takes the else path. Thanks

rscarr
Newbie
Posts: 4
Joined: Wed Nov 19, 2008 12:05 am

Re: ContainsText

Post by rscarr » Tue Feb 03, 2009 4:23 am

[quote=Try this line without the ">":
IF exists=1[/quote]

Mr. Hansen. I went back thru the code. In fact, your suggestion seems to work even though the debugger show EXITS=0 after IE_ContainsText.

Thank you sir.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Feb 04, 2009 3:34 am

To: rscarr

Mr. Hansen is my father. I am known as Bob. :lol:

Glad you are running.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Feb 04, 2009 3:37 am

So why does that IF work without the > Sir Bob?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Feb 04, 2009 6:00 am

Syntax....

This is my belief .....it is because of the history with the IF command.

The original syntax of IF, Version 4.3 - 9/28/97, was
IF>Expression,TrueLabel,FalseLabel

After about 7 years, in Version 7.3 10/28/04, it was made possible to do IF/ELSE/ENDIF and to calculate Complex Expressions inside curly braces
So a new syntax for IF was used:
IF {Expression1 AND Expression2}
DoStuff
ELSE
Do Something Else
ENDIF


Note the absence of the ">"
But the old syntax was also maintained for backwards compatibility.

The sample code posted here in the question is using the format of IF/ELSE so the ">" is left out. If the ">" is included, the logic is looking for older format, True/False labels.

But with that said, I seem to recall that one of the two formats works with and without the ">", no time to check it now.....

Hmm, first time someone called me sir and did not spell it cur. But I was never insulted, just thought they were calling me a Great Dane.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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