IE_ContainsText
Moderators: JRL, Dorian (MJT support)
IE_ContainsText
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?
[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?
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
I'm not familiar with IE_ContainsText> but try the If> like this:
If IE_ContainsText> returns the number of instances maybe you need >0 not =1?
Code: Select all
IF>exists=1
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
ContainsText
[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
[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
ContainsText
[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
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
Re: ContainsText
[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.
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.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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.
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!
Bob
A humble man and PROUD of it!