Multiple Text Recognition and tag a button

Discussions and Tech Support related to the iMacros Google Chrome extension.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Multiple Text Recognition and tag a button

Post by derrickrantel » Thu Jul 21, 2016 10:44 am

Hi all,
First of all i would like to thank everyone in advance for your help if you could provide me some advise.

I am working on a script to automate a process of interest registration on a certain webpage
I have been working on a basic script that is already working and does the below:
1) clicks on a "load results button"
(a result appears and then proceed to step 2)
2) clicks on the "submit interest button"
3) repeats

Most of the time there are no results found after step 1 and In this script i have SET !ERRORIGNORE YES, thus even if no results are displayed and the "enter interest button" does not appear, the script will still run and repeat.
Once a result is found upon step 1, the script will successfully run step 2 and tag the "submit interest button"
which submits my interest to register for this particular event to the website.

But now i would like to enhance my script for a more specific selection.
I would like the script to be able to identify multiple keyword/text that might or might not appear in the results, example "blue" "purple" "orange" "red"

some results may appear only with the keywords "orange"
or another result may appear only "blue" or "red" etc
or another result may appear with both the words "blue" and "red"
(not necessarily the keywords will all appear at the same time in 1 result displayed)
OR a result may appear but DOES NOT contain any of the keywords above named.
This is what i need it to do:
If EITHER of the keywords/text are found in the displayed results then click on the "submit interest button"
If a result is displayed but none of the keywords are found, DO NOT CLICK the "submit interest button" and continue to run script and repeat to load for more results.

it is important that the script does not click on the "submit interest button" unless the keywords are found which is the main purpose of the script identifying they keywords/text.

I have read that i can use SET !VAR1 EVAL method to achieve the above but i am not very good at program coding
thus i really need some of your expertise here to help me with this.
I am currently using the free Chrome version of Imacros

Please help with the below coding on how i can achieve the above mentioned outcome.

Here is the code which i currently have working but without the keyword/text recognition mentioned above:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

URL GOTO=https://www.exampletesting.com
SET !ENCRYPTION NO
'This section below will login my account on the website automatically'
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:login ATTR=ID:login:password CONTENT=mypassword
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:login ATTR=NAME:login:id1

'here, it clicks a "load results button
TAG POS=1 TYPE=IMG ATTR=SRC:https://loadresultsbutton.png
WAIT SECONDS=0.2
'here, it clicks on the "submit interest button' and then 'yes button' and finally a 'confirm button'
TAG POS=1 TYPE=IMG ATTR=SRC:https://submitinterest.png
TAG POS=1 TYPE=IMG ATTR=SRC:https://yes.png CONTENT=EVENT:MOUSEOVER
TAG POS=1 TYPE=IMG ATTR=SRC:https://confirm.png
WAIT SECONDS=0.3
Last edited by derrickrantel on Sun Jul 24, 2016 9:02 am, edited 1 time in total.
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple Text Recognition and tag a button

Post by chivracq » Thu Jul 21, 2016 1:36 pm

derrickrantel wrote:Hi all,
First of all i would like to thank everyone in advance for your help if you could provide me some advise.

I am working on a script to automate a process of interest registration on a certain webpage
I have been working on a basic script that is already working and does the below:
1) clicks on a "load results button"
(a result appears and then proceed to step 2)
2) clicks on the "submit interest button"
3) repeats

Most of the time there are no results found after step 1 and In this script i have SET !ERRORIGNORE YES, thus even if no results are displayed and the "enter interest button" does not appear, the script will still run and repeat.
Once a result is found upon step 1, the script will successfully run step 2 and tag the "submit interest button"
which submits my interest to register for this particular event to the website.

But now i would like to enhance my script for a more specific selection.
I would like the script to be able to identify multiple keyword/text that might or might not appear in the results, example "blue" "purple" "orange" "red"

some results may appear only with the keywords "orange"
or another result may appear only "blue" or "red" etc
or another result may appear with both the words "blue" and "red"
(not necessarily the keywords will all appear at the same time in 1 result displayed)
OR a result may appear but DOES NOT contain any of the keywords above named.
This is what i need it to do:
If EITHER of the keywords/text are found in the displayed results then click on the "submit interest button"
If a result is displayed but none of the keywords are found, DO NOT CLICK the "submit interest button" and continue to run script and repeat to load for more results.

it is important that the script does not click on the "submit interest button" unless the keywords are found which is the main purpose of the script identifying they keywords/text.

I have read that i can use SET !VAR1 EVAL method to achieve the above but i am not very good at program coding
thus i really need some of your expertise here to help me with this.
I am currently using the free Chrome version of Imacros

Please help with the below coding on how i can achieve the above mentioned outcome.

Here is the code which i currently have working but without the keyword/text recognition mentioned above:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

URL GOTO=https://www.exampletesting.com
SET !ENCRYPTION NO
'This section below will login my account on the website automatically'
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:login ATTR=ID:login:password CONTENT=mypassword
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:login ATTR=NAME:login:j_id68

'here, it clicks a "load results button
TAG POS=1 TYPE=IMG ATTR=SRC:https://loadresultsbutton.png
WAIT SECONDS=0.2
'here, it clicks on the "submit interest button' and then 'yes button' and finally a 'confirm button'
TAG POS=1 TYPE=IMG ATTR=SRC:https://submitinterest.png
TAG POS=1 TYPE=IMG ATTR=SRC:https://yes.png CONTENT=EVENT:MOUSEOVER
TAG POS=1 TYPE=IMG ATTR=SRC:https://confirm.png
WAIT SECONDS=0.3
Hum..., you've put some nice effort in your Post but CIM/FCIM for me to read, read my Sig, your Config is unclear as you are posting in the 'iMacros for CR' Sub-Forum while your Script mentions that you are using iMacros for FF v8.9.7..., and many Commands are not implemented for all Browsers/Versions, especially on CR...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Fri Jul 22, 2016 6:47 pm

Hi Chivracq,

i appreciate your effort in trying to help me. Thank you in advance.

Forgive me if im being ignorant as im not really an IT person.
Let me explain myself to the above.

Before this i was testing imacros to see if using on FF or Chrome is better.
Initially, i was using it on FF and i first created the script on FF, then after, i decided that i should use chrome instead.
For some reason chrome is more compatible with the website that i am using this application for.
Which after, i simply copy and paste the script from my FF onto chrome's and have been using it since.
It is, untill now, that you have mentioned "your Script mentions that you are using iMacros for FF v8.9.7"
(i did not know that from the script you could tell which browser or version i am using the script)
Would you kindly help correct the script for the right versions if required? Thanks

I am. infact, right now using Imacros addon plugin for Chrome.
Let me try to provide you the "FCIM" that you requested
(once again forgive me if i provide them wrongly, your advise is greatly appreciate)
1) Chrome Version 52.0.2743.82 m
2) Imacros for Chrome 8.4.4
3) My OS is Windows 10 Home Version 1511

You also mentioned that many commands are not implemented for certain browsers / versions.
Could you kindly advise if i am able to achieve the above for the versions and browsers i am using?

Lastly, im sorry to not provide the URLs as it is a private portal that that requires login (only for members of a group) but even if i did, you wouldn't be able to access to test the script as it requires a login.
Also, i hope you understand that i have edited the script to not show the URLs and button URLs, instead replacing the terms with context for easy understanding example: "confirm button" or a " submit interest button" etc.

Any help to be able to achieve my goal is greatly appreciated.
Thank you!
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Sat Jul 23, 2016 10:34 am

chivracq wrote: Hum..., you've put some nice effort in your Post but CIM/FCIM for me to read, read my Sig, your Config is unclear as you are posting in the 'iMacros for CR' Sub-Forum while your Script mentions that you are using iMacros for FF v8.9.7..., and many Commands are not implemented for all Browsers/Versions, especially on CR...
hi Chivracq,

Please advise if the above information is enough for you to provide me some help in the coding.
if it isnt let me know what else should i be providing you.

Thanks!

Sincerely,
derrick
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple Text Recognition and tag a button

Post by chivracq » Sat Jul 23, 2016 1:17 pm

derrickrantel wrote:Hi Chivracq,

i appreciate your effort in trying to help me. Thank you in advance.

Forgive me if im being ignorant as im not really an IT person.
Let me explain myself to the above.

Before this i was testing imacros to see if using on FF or Chrome is better.
Initially, i was using it on FF and i first created the script on FF, then after, i decided that i should use chrome instead.
For some reason chrome is more compatible with the website that i am using this application for.
Which after, i simply copy and paste the script from my FF onto chrome's and have been using it since.
It is, untill now, that you have mentioned "your Script mentions that you are using iMacros for FF v8.9.7"
(i did not know that from the script you could tell which browser or version i am using the script)
Would you kindly help correct the script for the right versions if required? Thanks

I am. infact, right now using Imacros addon plugin for Chrome.
Let me try to provide you the "FCIM" that you requested
(once again forgive me if i provide them wrongly, your advise is greatly appreciate)

Code: Select all

1) Chrome Version 52.0.2743.82 m
2) Imacros for Chrome 8.4.4
3) My OS is Windows 10 Home Version 1511
You also mentioned that many commands are not implemented for certain browsers / versions.
Could you kindly advise if i am able to achieve the above for the versions and browsers i am using?

Lastly, im sorry to not provide the URLs as it is a private portal that that requires login (only for members of a group) but even if i did, you wouldn't be able to access to test the script as it requires a login.
Also, i hope you understand that i have edited the script to not show the URLs and button URLs, instead replacing the terms with context for easy understanding example: "confirm button" or a " submit interest button" etc.

Any help to be able to achieve my goal is greatly appreciated.
Thank you!
derrickrantel wrote:
chivracq wrote: Hum..., you've put some nice effort in your Post but CIM/FCIM for me to read, read my Sig, your Config is unclear as you are posting in the 'iMacros for CR' Sub-Forum while your Script mentions that you are using iMacros for FF v8.9.7..., and many Commands are not implemented for all Browsers/Versions, especially on CR...
hi Chivracq,

Please advise if the above information is enough for you to provide me some help in the coding.
if it isnt let me know what else should i be providing you.

Thanks!

Sincerely,
derrick
No-no, that should be fine...

So, we now have your FCI and I was able to read your complete Opening Post...:

Code: Select all

1) Chrome Version 52.0.2743.82 m
2) Imacros for Chrome 8.4.4
3) My OS is Windows 10 Home Version 1511
Interesting Scenario, and indeed, you could use 'EVAL()' for your Purpose to spit out a 1 / 0 to reuse for 'TAG POS=n' when clicking (or not) on your 'Submit Interest' Button, but easier in your case would be to simply use Relative Positioning (+ Wildcards around each Keyword when tagging the Field containing your Results as the Anchor). And you repeat for each extra Keyword you want to include.
I've explained both Techniques in this Thread...:
- Workarounds for Conditional Logic in Macro Code

Same Logic if you want to include 2 Keywords at the same time, unless you know it's always 'ATTR=TXT:*red*blue*' in this order, you repeat with 'ATTR=TXT:*blue*red*', or you could use Triple Relative Positioning instead, or 5x Relative Positioning if you want 3 Keywords at the same time, etc..., ah-ah...!
(First time I mention 'Triple Relative Positioning" I think, search my Posts rather on "Double Relative Positioning" if you need more Info to understand the Principle...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: Multiple Text Recognition and tag a button

Post by iimfun » Sat Jul 23, 2016 1:31 pm

Derrick, I think that first of all you have to extract the text result appearing on the web page after clicking the “load results button”. So your code lacks the TAG command with the EXTRACT parameter. Then it will be possible to use the EVAL command in Chrome (or something else as Chivracq wrote), although JavaScript Scripting in iMacros plugin for Firefox is likely to be more helpful in cases like this.
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple Text Recognition and tag a button

Post by chivracq » Sat Jul 23, 2016 6:19 pm

iimfun wrote:Derrick, I think that first of all you have to extract the text result appearing on the web page after clicking the “load results button”. So your code lacks the TAG command with the EXTRACT parameter. Then it will be possible to use the EVAL command in Chrome (or something else as Chivracq wrote), although JavaScript Scripting in iMacros plugin for Firefox is likely to be more helpful in cases like this.
Yep, using a '.js' Script would do the "Job" and would be the "Standard" way indeed to achieve some Conditional Logic and the Thread I've referred contains Workarounds to achieve as well Conditional Logic in pure '.iim' Macros as '.js' Scripts are only available on FF.

And the first Technique I mentioned using 'EVAL()' requires indeed to first extract the Result Field. (Or could use the 'SEARCH' Command as well, instead of 'EXTRACT', but I find 'SEARCH' a bit difficult to use as it requires REGEX and I never took the time to dig a bit into the Documentation..., annd I find anyway EXTRACT=TXT or =HTM, together with 'EVAL()' + 'split()' more powerful than 'SEARCH'.)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Sun Jul 24, 2016 1:07 am

chivracq wrote: No-no, that should be fine...

So, we now have your FCI and I was able to read your complete Opening Post...:

Code: Select all

1) Chrome Version 52.0.2743.82 m
2) Imacros for Chrome 8.4.4
3) My OS is Windows 10 Home Version 1511
Interesting Scenario, and indeed, you could use 'EVAL()' for your Purpose to spit out a 1 / 0 to reuse for 'TAG POS=n' when clicking (or not) on your 'Submit Interest' Button, but easier in your case would be to simply use Relative Positioning (+ Wildcards around each Keyword when tagging the Field containing your Results as the Anchor). And you repeat for each extra Keyword you want to include.
I've explained both Techniques in this Thread...:
- Workarounds for Conditional Logic in Macro Code

Same Logic if you want to include 2 Keywords at the same time, unless you know it's always 'ATTR=TXT:*red*blue*' in this order, you repeat with 'ATTR=TXT:*blue*red*', or you could use Triple Relative Positioning instead, or 5x Relative Positioning if you want 3 Keywords at the same time, etc..., ah-ah...!
(First time I mention 'Triple Relative Positioning" I think, search my Posts rather on "Double Relative Positioning" if you need more Info to understand the Principle...)
Thank you both Chivracq and immfun
I appreciate both your help.

I will try to look into the links you have given me and try to see if i can figure something out.
Again i'm quite new to scripting so i might have a hard time understanding these commands haha.
I'll try my best tho! and if i have problems i'll relate here again and i hope you can give a little helping hand to correct my codes later on!

Cheers!!
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Sun Jul 24, 2016 1:21 am

Hi Chivracq
I'm having a hard time understanding how this works as i cant understand the Eval coding application.
Could you maybe help to give me a head start on the coding for my script and i try to see if i can edit it according to my application.

I admit that this is too complex for my understanding.
i apologize as i'm very new to this and i cant seem to understand how to use:
'EVAL()' for your Purpose to spit out a 1 / 0 to reuse for 'TAG POS=n' when clicking (or not) on your 'Submit Interest' Button
but easier in your case would be to simply use Relative Positioning (+ Wildcards around each Keyword when tagging the Field containing your Results as the Anchor).
Here is an example of the result that appears after click on "load more results" button
Image
The other possibility is that it loads no results, it will just NOT show this table and just show a text "no results"

So for example
My list of keywords will be "Blue" "red" "orange" "podium"
if under the field "Colour" the text "blue" is found, then click on the submit button
If the field "colour" the text is "purple", the script does NOT click on the submit button

Also, under the field "Level" if the text "Podium" appears, then click on the submit button

The below is abit more complicated incase of conditional behaviors but i'm not sure if it is possible. do let me know.
IF, Colour field is "Purple" but level field is "podium" , I still would like it to click on submit button.
by right "purple" is not what i want but then "podium" is what i want, so would i be able to make it still click on the submit button?

Your help is much appreciated
Cheers!
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Sun Jul 24, 2016 10:49 am

Hi Chivracq
I've so far tried this and it is working now.

TAG POS=1 TYPE=IMG ATTR=SRC:""Load results button.png"
WAIT SECONDS=1.5
TAG POS=1 TYPE=TD ATTR=TXT:*Blue*
TAG POS=R1 TYPE=IMG ATTR=SRC:"submit Interest.png"

Will this method work for IF either one of the keywords are found?
ATTR=TXT:*Blue*Red*Orange*
If i use the above , and the results display "RED" the imacros doesnt pick it up.
Can you guild me how to use this "Wildcard" command properly?
My concern is i need to have a list of 5 keywords for example. and if either 1 of the keywords appear. it will be able to pick it up and proceed to tag r1

Any help would be greatly appreciated.
Thanks in advance!
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple Text Recognition and tag a button

Post by chivracq » Sun Jul 24, 2016 12:37 pm

derrickrantel wrote:Hi Chivracq
I'm having a hard time understanding how this works as i cant understand the Eval coding application.
Could you maybe help to give me a head start on the coding for my script and i try to see if i can edit it according to my application.

I admit that this is too complex for my understanding.
i apologize as i'm very new to this and i cant seem to understand how to use:
'EVAL()' for your Purpose to spit out a 1 / 0 to reuse for 'TAG POS=n' when clicking (or not) on your 'Submit Interest' Button
but easier in your case would be to simply use Relative Positioning (+ Wildcards around each Keyword when tagging the Field containing your Results as the Anchor).
Here is an example of the result that appears after click on "load more results" button
Image
The other possibility is that it loads no results, it will just NOT show this table and just show a text "no results"

So for example
My list of keywords will be "Blue" "red" "orange" "podium"
if under the field "Colour" the text "blue" is found, then click on the submit button
If the field "colour" the text is "purple", the script does NOT click on the submit button

Also, under the field "Level" if the text "Podium" appears, then click on the submit button

The below is abit more complicated incase of conditional behaviors but i'm not sure if it is possible. do let me know.
IF, Colour field is "Purple" but level field is "podium" , I still would like it to click on submit button.
by right "purple" is not what i want but then "podium" is what i want, so would i be able to make it still click on the submit button?

Your help is much appreciated
Cheers!
As I said, easier is to use Relative Positioning, then you don't need to write any Coding with 'EVAL()' nor any JavaScript Expressions, but you seem to have started understanding that with your next/later Post, good...
derrickrantel wrote:Hi Chivracq
I've so far tried this and it is working now.

Code: Select all

TAG POS=1 TYPE=IMG ATTR=SRC:""Load results button.png"
WAIT SECONDS=1.5
TAG POS=1 TYPE=TD ATTR=TXT:*Blue*  
TAG POS=R1 TYPE=IMG ATTR=SRC:"submit Interest.png" 
Will this method work for IF either one of the keywords are found?
ATTR=TXT:*Blue*Red*Orange*
If i use the above , and the results display "RED" the imacros doesnt pick it up.
Can you guild me how to use this "Wildcard" command properly?
My concern is i need to have a list of 5 keywords for example. and if either 1 of the keywords appear. it will be able to pick it up and proceed to tag r1

Any help would be greatly appreciated.
Thanks in advance!
Yep, very good... Relative Positioning means IF Anchor is found (= HTML 'TD' Element containing "Blue") THEN click the POS=R1 Element. This is an easy way to achieve some Conditional Behaviour in pure '.iim'. If the Anchor is not found, the 'POS=R1' Statement will do nothing. (You need to use '!ERRORIGNORE' of course, and to shorten '!TIMEOUT_STEP' to 1 or 0 to speed up the Processing.)

But no, "ATTR=TXT:*Blue*Red*Orange*" means that you want all 3 Keywords to be present at the same time, and in this specific order. I've already explained that in my previous Post and said that you need to repeat for each Colour/Keyword:

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

TAG POS=1 TYPE=IMG ATTR=SRC:""Load results button.png"
WAIT SECONDS=1.5

' Level = "podium":
TAG POS=1 TYPE=TD ATTR=TXT:*podium* 
TAG POS=R1 TYPE=IMG ATTR=SRC:"submit Interest.png"
'>
' Colour = Blue:
TAG POS=1 TYPE=TD ATTR=TXT:*Blue* 
TAG POS=R1 TYPE=IMG ATTR=SRC:"submit Interest.png"
'>
' Colour = Red:
TAG POS=1 TYPE=TD ATTR=TXT:*Red* 
TAG POS=R1 TYPE=IMG ATTR=SRC:"submit Interest.png"
'>
' Colour = Orange:
TAG POS=1 TYPE=TD ATTR=TXT:*Orange* 
TAG POS=R1 TYPE=IMG ATTR=SRC:"submit Interest.png"
'>
' Etc..., any other Colour/Level...!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple Text Recognition and tag a button

Post by chivracq » Sun Jul 24, 2016 12:58 pm

The only "Danger" with the Script Example in my previous Post is that "Purple + podium" will maybe not be clicked if that Row is located after a "Blue + podium" Row like in your Printscreen and you would even click twice on the 'Submit' Button for "Blue + podium", depending on if the Button remains clickable after you've already clicked once or if it becomes disabled, but then because I've placed the 'podium' Section before the 'Blue' Section, the 'Blue' Section would try to click on the 'Submit' Button from the next Row.
So you have to choose carefully the Order of all Sections in your Script, and maybe include several 'podium' Sections, with 'POS=1' + 'POS=2' + 'POS=3'...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Sun Jul 24, 2016 2:16 pm

chivracq wrote:The only "Danger" with the Script Example in my previous Post is that "Purple + podium" will maybe not be clicked if that Row is located after a "Blue + podium" Row like in your Printscreen and you would even click twice on the 'Submit' Button for "Blue + podium", depending on if the Button remains clickable after you've already clicked once or if it becomes disabled, but then because I've placed the 'podium' Section before the 'Blue' Section, the 'Blue' Section would try to click on the 'Submit' Button from the next Row.
So you have to choose carefully the Order of all Sections in your Script, and maybe include several 'podium' Sections, with 'POS=1' + 'POS=2' + 'POS=3'...
I would like to thank you very much for your help Chivracq. i now understand this and will rethink how to selet my keywords properly with the conditions available.

Right now i'm facing another problem, i was hoping you can help me with this

My working code right now:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

URL GOTO=https://testwebsite.com

TAG POS=1 TYPE=IMG ATTR=SRC:https://load results.png
WAIT SECONDS=3
TAG POS=1 TYPE=TD ATTR=TXT:*blue*  
TAG POS=R1 TYPE=IMG ATTR=SRC:SubmitInterest.png
TAG POS=1 TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER
TAG POS=1 TYPE=IMG ATTR=SRC:hover_Confirm.png
WAIT SECONDS=0.3
This works perfectly when:
a result is displayed and it contains the text "BLUE". the script runs through the rest and works like a charm.

But somehow, when a result is displayed BUT it did not contain the text "BLUE", naturally, the script Skips the next step
TAG POS=R1 TYPE=IMG ATTR=SRC:SubmitInterest.png
But i think it still continues running:
TAG POS=1 TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER
TAG POS=1 TYPE=IMG ATTR=SRC:hover_Confirm.png
I need to let you know that this "Confirm Button" appears in a little popup screen inside of the webpage.
This is where i need to event a mouseover on confirm.png and then click on the hover_confirm.png button

But these buttons and the popup box did not appear because
TAG POS=R1 TYPE=IMG ATTR=SRC:SubmitInterest.png did not execute as the text blue was not found.
but of course the script cont to run it and i have the SET !ERRORIGNORE YES so by right it shld just ignore this.

Problem:
Somehow after the final step
TAG POS=1 TYPE=IMG ATTR=SRC:hover_Confirm.png
the webpage loaded into an errorpage saying that i have no connection and i should relog in.
I am not sure how did the last step cause the webpage to load an error since that button did not exist in the page

My solution:
If i were able to not let the last step execute would solve the problem.
I tried to put Pos=R1 in the last step like so.... TAG POS=R1 TYPE=IMG ATTR=SRC:hover_Confirm.png
somehow hoping that it would depend if TAG POS=1 TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER was successful then it will execute the final step.

But this did not work it stopped working after the mouseover step. not sure why but might be because they are buttons in a popup box.. and R1 just was not able to work for this instance

How can i ensure tat the final step executes only if the Mouseover step was successful??
Can you provide some help Chivracq?
Thanks in advance.
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Multiple Text Recognition and tag a button

Post by chivracq » Sun Jul 24, 2016 4:31 pm

derrickrantel wrote:
chivracq wrote:The only "Danger" with the Script Example in my previous Post is that "Purple + podium" will maybe not be clicked if that Row is located after a "Blue + podium" Row like in your Printscreen and you would even click twice on the 'Submit' Button for "Blue + podium", depending on if the Button remains clickable after you've already clicked once or if it becomes disabled, but then because I've placed the 'podium' Section before the 'Blue' Section, the 'Blue' Section would try to click on the 'Submit' Button from the next Row.
So you have to choose carefully the Order of all Sections in your Script, and maybe include several 'podium' Sections, with 'POS=1' + 'POS=2' + 'POS=3'...
I would like to thank you very much for your help Chivracq. i now understand this and will rethink how to selet my keywords properly with the conditions available.

Right now i'm facing another problem, i was hoping you can help me with this

My working code right now:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

URL GOTO=https://testwebsite.com

TAG POS=1 TYPE=IMG ATTR=SRC:https://load results.png
WAIT SECONDS=3
TAG POS=1 TYPE=TD ATTR=TXT:*blue*  
TAG POS=R1 TYPE=IMG ATTR=SRC:SubmitInterest.png
TAG POS=1 TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER
TAG POS=1 TYPE=IMG ATTR=SRC:hover_Confirm.png
WAIT SECONDS=0.3
This works perfectly when:
a result is displayed and it contains the text "BLUE". the script runs through the rest and works like a charm.

But somehow, when a result is displayed BUT it did not contain the text "BLUE", naturally, the script Skips the next step
TAG POS=R1 TYPE=IMG ATTR=SRC:SubmitInterest.png
But i think it still continues running:
TAG POS=1 TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER
TAG POS=1 TYPE=IMG ATTR=SRC:hover_Confirm.png
I need to let you know that this "Confirm Button" appears in a little popup screen inside of the webpage.
This is where i need to event a mouseover on confirm.png and then click on the hover_confirm.png button

But these buttons and the popup box did not appear because
TAG POS=R1 TYPE=IMG ATTR=SRC:SubmitInterest.png did not execute as the text blue was not found.
but of course the script cont to run it and i have the SET !ERRORIGNORE YES so by right it shld just ignore this.

Problem:
Somehow after the final step
TAG POS=1 TYPE=IMG ATTR=SRC:hover_Confirm.png
the webpage loaded into an errorpage saying that i have no connection and i should relog in.
I am not sure how did the last step cause the webpage to load an error since that button did not exist in the page

My solution:
If i were able to not let the last step execute would solve the problem.
I tried to put Pos=R1 in the last step like so.... TAG POS=R1 TYPE=IMG ATTR=SRC:hover_Confirm.png
somehow hoping that it would depend if TAG POS=1 TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER was successful then it will execute the final step.

But this did not work it stopped working after the mouseover step. not sure why but might be because they are buttons in a popup box.. and R1 just was not able to work for this instance

How can i ensure tat the final step executes only if the Mouseover step was successful??
Can you provide some help Chivracq?
Thanks in advance.
hum..., then you will still have to use (a mix of with) the first Method using 'EVAL()' to spit out a 1/0 to reuse for 'POS=n' for the 2 'Confirm' Actions, stg like:

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

URL GOTO=https://testwebsite.com

TAG POS=1 TYPE=IMG ATTR=SRC:https://load results.png
WAIT SECONDS=3

SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:*blue* EXTRACT=TXT
TAG POS=R1 TYPE=IMG ATTR=SRC:SubmitInterest.png
SET Confirm EVAL("var s='{{!EXTRACT}}'; var x; if(s!='#EANF#'){x=1;} else{x=0;}; x;")
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:hover_Confirm.png
WAIT SECONDS=0.3
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
derrickrantel
Posts: 11
Joined: Thu Jul 21, 2016 9:50 am

Re: Multiple Text Recognition and tag a button

Post by derrickrantel » Sun Jul 24, 2016 7:54 pm

Thanks chivracq
Ive implemented the same code you provided me but somehow still not working.

Ive also tried this and its not working

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
SET !EXTRACT_TEST_POPUP NO

URL GOTO=https://www.testingwebsite.com
TAG POS=1 TYPE=IMG ATTR=SRC:Loadmoreresults.png
WAIT SECONDS=3
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:*Blue* EXTRACT=TXT
SET Confirm EVAL("var s='{{!EXTRACT}}'; var x; if(s!='#EANF#'){x=1;} else{x=0;}; x;")
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:SumitInterest.png
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:Confirm.png CONTENT=EVENT:MOUSEOVER
TAG POS={{Confirm}} TYPE=IMG ATTR=SRC:Hover_Confirm.png
Both ways either yours or mine both codes still executing the Confirm button and hover_confirm buttons

Searched the forum and someone mentioned SET !ERRORIGNORE YES will cause EANF to not work.
i'm not sure what it means but do you think you can help me solve this?
Thanks
Post Reply