Unable to Extract Text from Within the TextArea

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
Post Reply
priteshd
Posts: 4
Joined: Mon Jun 03, 2019 11:59 pm

Unable to Extract Text from Within the TextArea

Post by priteshd » Tue Jun 04, 2019 12:36 am

Windows 10 - 1809
Firefox Browser - Version 46 ( Portable )
FF Addon for Imacro Version - 8.9.7

============

Issue - Unable to select txt within textArea in a modal popup ( Page source shows nothing within the textarea )

My "Failed" code

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=https://www.groupon.de/deals/zayas-brunnen-2-16762055
URL GOTO=javascript:(function()%7baffiliateCountries='.groupon.de,.groupon.ae,.groupon.com.ar,.groupon.com.au,.groupon.be,.groupon.com.br,.groupon.es,.groupon.fr,.groupon.hk,.groupon.ie,.groupon.co.il,.groupon.it,.groupon.my,.groupon.nl,.grouponnz.co.nz,.groupon.pl,.groupon.sg,.groupon.co.uk,.groupon.co.za';gpnWebSite=[%7b'id':204548,%20'name':'http://www.aktivitys.com'%7d%5d;gpnAffiliateId='203870';%20gpnBaseURL='https://partner-int.groupon.com';if(document.getElementById('GrouponBookmarkletScript')%20!=%20null)%7bToggleStripe();%7delse%7b%20var%20aScript%20=%20document.createElement('script');aScript.setAttribute('id',%20'GrouponBookmarkletScript');aScript.setAttribute('type',%20'text/javascript');aScript.setAttribute('src',%20'https://partner-int.groupon.com/assets/js/Bookmarklet.js?v='%20+%20new%20Date());document.getElementsByTagName('head')%5b0%5d.appendChild(aScript);%7d%7d)()
WAIT SECONDS=4
TAG POS=1 TYPE=TEXTAREA ATTR=ID:pnlDirectlink EXTRACT=TXT
capture.jpg
Thank you all of you for this wonderful forum .
Last edited by priteshd on Tue Jun 04, 2019 3:26 am, edited 1 time in total.
chivracq
Posts: 8523
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Rare & Strange Issue - Please Advise

Post by chivracq » Tue Jun 04, 2019 1:34 am

priteshd wrote:
Tue Jun 04, 2019 12:36 am

Code: Select all

Windows 10 - 1809
Firefox Browser - Version 46 ( Portable )
FF Addon  for Imacro Version - 8.9.7
============

Issue - Unable to select txt within textArea in a modal popup ( Page source shows nothing within the textarea )

My "Failed" code

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=https://www.groupon.de/deals/zayas-brunnen-2-16762055
URL GOTO=javascript:(function()%7baffiliateCountries='.groupon.de,.groupon.ae,.groupon.com.ar,.groupon.com.au,.groupon.be,.groupon.com.br,.groupon.es,.groupon.fr,.groupon.hk,.groupon.ie,.groupon.co.il,.groupon.it,.groupon.my,.groupon.nl,.grouponnz.co.nz,.groupon.pl,.groupon.sg,.groupon.co.uk,.groupon.co.za';gpnWebSite=[%7b'id':204548,%20'name':'http://www.aktivitys.com'%7d%5d;gpnAffiliateId='203870';%20gpnBaseURL='https://partner-int.groupon.com';if(document.getElementById('GrouponBookmarkletScript')%20!=%20null)%7bToggleStripe();%7delse%7b%20var%20aScript%20=%20document.createElement('script');aScript.setAttribute('id',%20'GrouponBookmarkletScript');aScript.setAttribute('type',%20'text/javascript');aScript.setAttribute('src',%20'https://partner-int.groupon.com/assets/js/Bookmarklet.js?v='%20+%20new%20Date());document.getElementsByTagName('head')%5b0%5d.appendChild(aScript);%7d%7d)()
WAIT SECONDS=4
TAG POS=1 TYPE=TEXTAREA ATTR=ID:pnlDirectlink EXTRACT=TXT
capture.jpg

Thank you all of you for this wonderful forum .
Yeah, but give a Descriptive Title to your Thread for me to read... (and certainly answer)... :roll:

FCI mentioned: Good... :D
Thread opened in the 'iMacros for FF' Sub-Forum: => What is specific to FF...? Does your Script work in other Browsers...? Mention their FCI also...

And what is your long 'URL GOTO=javascript' Statement "supposed" to do...?

And what do you get in the 'EXTRACT'...?
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
priteshd
Posts: 4
Joined: Mon Jun 03, 2019 11:59 pm

Re: Rare & Strange Issue - Please Advise

Post by priteshd » Tue Jun 04, 2019 1:58 am

1. Never used any other browser or combination. Have always used FF + Imacro
2. Javascript is to opens the Modal POP up which further generates these unique links ( Its basically a simple bookmarklet )
3. Extract is EMPTY



Thank you for your time and effort sir, would love to somehow make this work :)
chivracq
Posts: 8523
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Rare & Strange Issue - Please Advise

Post by chivracq » Tue Jun 04, 2019 2:44 am

priteshd wrote:
Tue Jun 04, 2019 1:58 am
1. Never used any other browser or combination. Have always used FF + Imacro
2. Javascript is to opens the Modal POP up which further generates these unique links ( Its basically a simple bookmarklet )
3. Extract is EMPTY

Thank you for your time and effort sir, would love to somehow make this work :)
Oh...!, OK, but again, give a Descriptive Title to your Thread for me to follow up...! :roll:
Or try searching the Forum for similar Threads using "Rare+Strange+Issue+Please+Advise" as Keywords, your Answer is probably there... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
priteshd
Posts: 4
Joined: Mon Jun 03, 2019 11:59 pm

Re: Unable to Extract Text from Within the TextArea

Post by priteshd » Tue Jun 04, 2019 3:27 am

Improved the Thread Title as per your request.
chivracq
Posts: 8523
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Unable to Extract Text from Within the TextArea

Post by chivracq » Tue Jun 04, 2019 3:49 am

priteshd wrote:
Tue Jun 04, 2019 3:27 am
Improved the Thread Title as per your request.
Oh...!, good, finally...! This one is perfect... :wink:

OK, I had a look at your Site, and your Script just works fine for me, it extracts the Content of the 'Direct Link' Field in the Popup:

Code: Select all

http://t.groupon.de/r?tsToken=DE_AFF_0_203870_1951473_0&url=https%3A%2F%2Fwww.groupon.de%2Fdeals%2Fzayas-brunnen-2-16762055%3FCID%3DDE_AFF_5600_225_5383_1%26z%3Dskip%26utm_medium%3Dafl%26utm_campaign%3D203870%26mediaId%3D1951473%26utm_source%3DGPN
Tested on:

Code: Select all

- iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.
- iMacros for FF v8.9.7, FF v55.0.3, Win10_x64.
For both FCI's, I need to launch the URL of the Page a bit manually or to pause the Script while the Page is loading as I get some extra Popup about "Registering"/"Anmelden" to their Site that I first have to dismiss but your Script then works fine... :D
And on FF, I had to increase the 'WAIT' to 6 Sec, or the Popup doesn't always have the time to get populated. (And then I do get an Empty String as the Result of the 'EXTRACT' if the 'WAIT' is too short...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
priteshd
Posts: 4
Joined: Mon Jun 03, 2019 11:59 pm

Re: Unable to Extract Text from Within the TextArea

Post by priteshd » Tue Jun 04, 2019 4:40 am

Excellent . Super Thanks to you sir.
chivracq
Posts: 8523
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Unable to Extract Text from Within the TextArea

Post by chivracq » Tue Jun 04, 2019 5:38 am

priteshd wrote:
Tue Jun 04, 2019 4:40 am
Excellent . Super Thanks to you sir.
Yeah, OK, but does it work for you now also...?, by increasing a bit the 'WAIT', I reckon...?

Hum, and I was going to suggest some "Improvement" if you wanted to shorten the 'WAIT' to the minimum necessary until the Field gets populated by using '!TIMEOUT_STEP' instead of 'WAIT', but it doesn't work... :oops: :

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
TAB T=1
'URL GOTO=https://www.groupon.de/deals/zayas-brunnen-2-16762055
URL GOTO=javascript:(function()%7baffiliateCountries='.groupon.de,.groupon.ae,.groupon.com.ar,.groupon.com.au,.groupon.be,.groupon.com.br,.groupon.es,.groupon.fr,.groupon.hk,.groupon.ie,.groupon.co.il,.groupon.it,.groupon.my,.groupon.nl,.grouponnz.co.nz,.groupon.pl,.groupon.sg,.groupon.co.uk,.groupon.co.za';gpnWebSite=[%7b'id':204548,%20'name':'http://www.aktivitys.com'%7d%5d;gpnAffiliateId='203870';%20gpnBaseURL='https://partner-int.groupon.com';if(document.getElementById('GrouponBookmarkletScript')%20!=%20null)%7bToggleStripe();%7delse%7b%20var%20aScript%20=%20document.createElement('script');aScript.setAttribute('id',%20'GrouponBookmarkletScript');aScript.setAttribute('type',%20'text/javascript');aScript.setAttribute('src',%20'https://partner-int.groupon.com/assets/js/Bookmarklet.js?v='%20+%20new%20Date());document.getElementsByTagName('head')%5b0%5d.appendChild(aScript);%7d%7d)()

SET !TIMEOUT_STEP 10
TAG POS=1 TYPE=TEXTAREA ATTR=ID:pnlDirectlink&&TXT:*groupon* EXTRACT=TXT
The Text Content in the 'TEXTAREA' Field really gets added on the fly and is not present in the Source of the Page, so it doesn't work...

If you want to shorten the 'WAIT', it would be possible to first try to extract that Content after a fixed 'WAIT=4' for example, plus to add a Conditional 'WAIT' for another 2 Sec for example to "try" again 2 Sec later if the 1st 'EXTRACT' was still empty... But I guess hard-coding a fixed 'WAIT=6' or maybe even 'WAIT=8' will probably be easier if you go for Reliability and don't mind your Script waiting for a "safe" 6 or 8 Sec... :wink:

>>>

Oh...!, and you can drop the "Sir", we have Technical Ladies on the Forum also... :idea:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
User avatar
thecoder2012
Posts: 325
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Unable to Extract Text from Within the TextArea

Post by thecoder2012 » Thu Jul 04, 2019 9:19 am

chivracq wrote:
Tue Jun 04, 2019 5:38 am
Hum, and I was going to suggest some "Improvement" if you wanted to shorten the 'WAIT' to the minimum necessary until the Field gets populated by using '!TIMEOUT_STEP' instead of 'WAIT', but it doesn't work... :oops: :
You can check the field but not the on-the-fly content in this case.

Code: Select all

TAB T=1
URL GOTO=https://www.groupon.de/deals/zayas-brunnen-2-16762055
URL GOTO=javascript:(function()%7baffiliateCountries='.groupon.de,.groupon.ae,.groupon.com.ar,.groupon.com.au,.groupon.be,.groupon.com.br,.groupon.es,.groupon.fr,.groupon.hk,.groupon.ie,.groupon.co.il,.groupon.it,.groupon.my,.groupon.nl,.grouponnz.co.nz,.groupon.pl,.groupon.sg,.groupon.co.uk,.groupon.co.za';gpnWebSite=[%7b'id':204548,%20'name':'http://www.aktivitys.com'%7d%5d;gpnAffiliateId='203870';%20gpnBaseURL='https://partner-int.groupon.com';if(document.getElementById('GrouponBookmarkletScript')%20!=%20null)%7bToggleStripe();%7delse%7b%20var%20aScript%20=%20document.createElement('script');aScript.setAttribute('id',%20'GrouponBookmarkletScript');aScript.setAttribute('type',%20'text/javascript');aScript.setAttribute('src',%20'https://partner-int.groupon.com/assets/js/Bookmarklet.js?v='%20+%20new%20Date());document.getElementsByTagName('head')%5b0%5d.appendChild(aScript);%7d%7d)()
SET !TIMEOUT_STEP 8
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=TEXTAREA ATTR=ID:pnlDirectlink EXTRACT=TXT
SET !EXTRACT_TEST_POPUP YES
WAIT SECONDS = 2.5
TAG POS=1 TYPE=TEXTAREA ATTR=ID:pnlDirectlink EXTRACT=TXT
chivracq wrote:
Tue Jun 04, 2019 5:38 am
If you want to shorten the 'WAIT', it would be possible to first try to extract that Content after a fixed 'WAIT=4' for example, plus to add a Conditional 'WAIT' for another 2 Sec for example to "try" again 2 Sec later if the 1st 'EXTRACT' was still empty... But I guess hard-coding a fixed 'WAIT=6' or maybe even 'WAIT=8' will probably be easier if you go for Reliability and don't mind your Script waiting for a "safe" 6 or 8 Sec... :wink:
It's easy in Javascript. But with pure iim it's possible with your explanation.

Solution in Javascript:

Code: Select all

newscript = "CODE:";
newscript +=  "TAB T=1" + "\n";
newscript +=  "URL GOTO=https://www.groupon.de/deals/zayas-brunnen-2-16762055" + "\n";
newscript +=  "URL GOTO=javascript:(function()%7baffiliateCountries='.groupon.de,.groupon.ae,.groupon.com.ar,.groupon.com.au,.groupon.be,.groupon.com.br,.groupon.es,.groupon.fr,.groupon.hk,.groupon.ie,.groupon.co.il,.groupon.it,.groupon.my,.groupon.nl,.grouponnz.co.nz,.groupon.pl,.groupon.sg,.groupon.co.uk,.groupon.co.za';gpnWebSite=[%7b'id':204548,%20'name':'http://www.aktivitys.com'%7d%5d;gpnAffiliateId='203870';%20gpnBaseURL='https://partner-int.groupon.com';if(document.getElementById('GrouponBookmarkletScript')%20!=%20null)%7bToggleStripe();%7delse%7b%20var%20aScript%20=%20document.createElement('script');aScript.setAttribute('id',%20'GrouponBookmarkletScript');aScript.setAttribute('type',%20'text/javascript');aScript.setAttribute('src',%20'https://partner-int.groupon.com/assets/js/Bookmarklet.js?v='%20+%20new%20Date());document.getElementsByTagName('head')%5b0%5d.appendChild(aScript);%7d%7d)()" + "\n";
newscript +=  "SET !EXTRACT NULL" + "\n";
newscript +=  "TAG POS=1 TYPE=TEXTAREA ATTR=ID:pnlDirectlink EXTRACT=TXT" + "\n";
iimPlay(newscript);

var result = "";
while(true){
	iimPlay("CODE:TAG POS=1 TYPE=TEXTAREA ATTR=ID:pnlDirectlink EXTRACT=TXT");
	var ret = iimGetExtract();
	if(ret.length>10){
		result = ret;
		break;
	}else{
		iimPlay("CODE:WAIT SECONDS = 0.1");
	}
}
iimDisplay(result);
Tested with Pale Moon 28.6.0 (64-Bit), iMacros 8.9.7 and Win8.1 (64-Bit)
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Post Reply