Fill Facebook forms with javascript and imacros

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
rapieragnay
Posts: 11
Joined: Sun Jan 24, 2021 11:06 am

Fill Facebook forms with javascript and imacros

Post by rapieragnay » Sun Jan 24, 2021 11:16 am

Hi all,

Config : iMacros 8.9.7 + Firefox 52.0 + MacOS 10.11

I have to fill automatically this kind of forms : https://www.facebook.com/events/create/
capture 2021-01-24 à 08.18.59.jpg

I'm using javascript and imacros for that.

Code: Select all

event_name = window.document.querySelectorAll("label[aria-label='Event name']")[1].getAttribute("for");
iimPlayCode('TAG XPATH="//input[@id="'+event_name+'"] CONTENT="Pool Party"'+'\n');

With the new Facebook, it seems very difficult. I want the job get done while my browser is reduced and I'm doing other stuff. The big deal is that some dropdown list can't operated without having focus on it.

Is there a trick to trigger the function attached with and set the value to the first element for example ?
capture 2021-01-24 à 08.34.33.jpg
Last edited by rapieragnay on Sun Jan 24, 2021 3:49 pm, edited 2 times in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill Facebook forms with javascript and imacros

Post by chivracq » Sun Jan 24, 2021 2:41 pm

rapieragnay wrote:
Sun Jan 24, 2021 11:16 am
Hi all,


I have to fill automatically this kind of forms : https://www.facebook.com/events/create/

Code: Select all

https://pasteboard.co/JL52Ohn.jpg
I'm using javascript and imacros for that.

Code: Select all

event_name = window.document.querySelectorAll("label[aria-label='Event name']")[1].getAttribute("for");
iimPlayCode('TAG XPATH="//input[@id="'+event_name+'"] CONTENT="Pool Party"'+'\n');

With the new Facebook, it seems very difficult. I want the job get done while my browser is reduced and I'm doing other stuff. The big deal is that some dropdown list can't operated without having focus on it.

Is there a trick to trigger the function attached with and set the value to the first element for example ?

Code: Select all

https://pasteboard.co/JL53WCT.jpg

Hum..., Thread approved, but it would "help" if you read the Forum Rules when you join a (Tech) Forum... :idea:

=> Can you (re-)upload your Screenshots directly to the Forum...?, without using any external Pix Hosting Site, like explained in the Forum Rules... This Hosting Site doesn't even work in my (Default) Browser (PM26)... :roll:
You can leave the Links to this Site if you want, but you also need to upload the Screenshots to our Forum, as those Links will probably go "dead" one day...

+ (F)CIM...! :mrgreen: (Read my Sig also...)

>>>

For those "interested", + parallel Thread on SOF:
- Fill Facebook forms with javascript
(Same Content, FCI also not mentioned..., 1 Comment saying "automating facebook is not allowed, that is why they made it extra-hard for you.")

@OP, the "(F)CI(M)" part will also "apply" (for me to want to help you) to your SOF Thread also..., perfectly fine to open parallel Threads on different Tech Forums, but you need to provide the same "Quality" on all of them... :idea:
And I guess they'll probably ask you also to (re-)upload your Screenshots to "their" Hosting Site... (They have a dedicated Sub-Domain at 'imgur'.) (I don't "care", not Blocking for me...)

And I "usually" don't help for Social Media..., but hum..., OK for this one..., (well, if you "handle" the 'Screenshots' + 'FCI' parts "correctly", I won't be asking several times...), I "probably" have an "easy" Solution, I "think"... :P
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
rapieragnay
Posts: 11
Joined: Sun Jan 24, 2021 11:06 am

Re: Fill Facebook forms with javascript and imacros

Post by rapieragnay » Sun Jan 24, 2021 3:42 pm

Hi chivracq,

So, my full config is :
- iMacros : 8.9.7
- Firefox : 52.0.2 (I can upgrade to 55.0.3 :D )
- OS : MacOS 10.11 and Windows 7 32bit (sometimes)

I'll gonna edit the topic and upload these screenshots directly on the forum
--> I'm going to edit the topic.

Thank you
Last edited by rapieragnay on Fri Jan 29, 2021 8:37 am, edited 1 time in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill Facebook forms with javascript and imacros

Post by chivracq » Sun Jan 24, 2021 4:17 pm

rapieragnay wrote:
Sun Jan 24, 2021 3:42 pm
Hi chivracq,

So, my full config is :

Code: Select all

- iMacros : 8.9.7
- Firefox : 52.0.2 (I can upgrade to 55.0.3  :D )  
- OS : MacOS 10.11 and Windows 7 32bit (sometimes)
I'll gonna edit the topic and upload these screenshots directly on the forum

Thank you

Alright..., "nearly" perfect for your FCI, but can you (also) add that Info to your OP...? (Preferably at the very top, this is the first Info I and any other Advanced Users need to read/know about your Thread/Scenario/Case, and it's not very "handy" if we have to search for that Info through the whole Thread to find out if "maybe" you've mentioned it "somewhere"...)
And don't forget to add your FCI to your Thread on SOF also... (I haven't checked yet...)

FF52 is fine, I guess you are probably on the ESR Channel, I reckon..., FF52 <=> FF55 won't play a "Role" for your Case...

>>>

And hum..., I'm "allergic" to "gonna-gonna-wanna-wanna" fake Chicago Gangsta-Kids-Langua...! :roll: , please use "Standard" English on the Forum..., you don't need to "pretend" they speak that Dialect in "Tanana-City", even if that nicely "rhymes", ah-ah...! But this is a Technical Forum, don't really expect much "Poetry" here, ah-ah...! :P :wink:

+ "I'll gonna" is btw grammatically not even correct, (yep...!, even Chicago Gangsta-Street-Kiddos "respect" some Grammar, ah-ah...! :shock: ), "gonna" means "going to", and "I'll" = "I will" is grammatically incompatible with "going to" or your fake "gonna", correct would be "I'll edit..."/"I will edit..." or "I'm going to edit..." which would give "I'm gonna edit..." with your "gonna-wanna" Dialect..., but your "I'll gonna edit..." is not possible..., grrr...! :idea:

OK, I'll check both Threads "a bit later", I let you edit your OP... 8)
(Or post a min-Update once you're "done"...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill Facebook forms with javascript and imacros

Post by chivracq » Sun Jan 24, 2021 5:53 pm

Alright, your OP now looks "perfect" to me, good-good...!, and Thanks...! :D

And I was going to post a working Script, as I already started to do a bit of "Testing" after my last Reply, but hum..., I notice you didn't add your FCI to your Thread on SOF like I asked you..., hum, then OK, maybe "later" then, fair enough... :o

>>>

And the Comment from the User on SOF made me laugh a little bit, because the Script/Solution I came with is different from the "easy Solution" I had in mind, which probably also works, I would think/expect, but that "new" Solution actually got me "served on a golden plate" by FB the Site itself, ah-ah...!, so some Measure to prevent Automation (if that User is "correct", I don't know, I've never seen that in their EULA/Policy/whatever...) actually turns out to "facilitate" Web-Automation, ah-ah...! :twisted:

>>>

And hum, about FF52/FF55 again, FF52 might actually be "better" than FF55, ah-ah...!, or at least for the first Solution I had in mind, if you still wanted to use or try it..., the "new" one works fine in FF55 (+ v8.9.7 for FF indeed), because I do use FF v55.0.3 for myself indeed, but since about 2 weeks approx, I can't use FF in that Browser anymore, FF55 will crash/hang within a few Seconds after opening any FB Page, oops...!
I since have to use that stupid CR-Browser that I don't like at all (CR76) only because of FB, grrr...!! As the Func I "use" on FB doesn't work either since about the same time in PM26, my (Default) Browser that I was using for FB until then... :(
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
rapieragnay
Posts: 11
Joined: Sun Jan 24, 2021 11:06 am

Re: Fill Facebook forms with javascript and imacros

Post by rapieragnay » Sun Jan 24, 2021 6:39 pm

About the I'll gonna.
Excuse me for my bad English. I was using Google Translate. But this time I try to bypass G Translate and the result is catastrophic!

I am amazed that already have two solutions.

I stayed to used FF 52 just because of imacros especially the possibility of having javascript with. Usually I'm surfing the web with Opera.
User avatar
thecoder2012
Posts: 446
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Fill Facebook forms with javascript and imacros

Post by thecoder2012 » Sun Jan 24, 2021 6:54 pm

rapieragnay wrote:
Sun Jan 24, 2021 6:39 pm
I stayed to used FF 52 just because of imacros especially the possibility of having javascript with. Usually I'm surfing the web with Opera.
Better is Waterfox (Classic) or Basilisk Browser than very old FF 52 in this case with Javascript (or ui.vision with modern browsers). Usually (security) updates are important.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill Facebook forms with javascript and imacros

Post by chivracq » Mon Feb 01, 2021 4:52 am

Some Quick Update for @OP, I had seen you had mentioned your FCI on your SOF Thread..., that you've since deleted, which is usually a Show-Stopper for me, but OK, I still want to post the Script I had made when you had opened the Thread, so here it is, without any Explanation...:

Oh shit-shit....!, oops...!, I'm not trying to be "mean", but oops, double-oops...!!, several Testing Scripts "since", and I've tried to keep your Script all that time, but apparently I still made a "Mistake" between all 'Edit'/'Record'/'Save_as' since more than one week, ah-ah...!, and I don't have it anymore...! :(
(Was exactly the "Purpose" of this Post, as I was "afraid" i might lose that Script, but apparently I was was too late, ah-ah...! :oops: )

OK, was not difficult to do, took me less than 3 min "then"..., was based on using the FB-Mobile Version... :idea:

And my "first Solution" was based on using the 'EVENT' Mode... (on FB "Standard")... :idea:

>>>

And if you don't find "the Solution" by yourself (using FB-Mobile), then pfff... :roll: , send 10E/10$/10_Tanana_Money/or_whatever_ah_ah...! to [My_Username]@gmail.com via 'PayPal', and Okay..., I'll make and test the Script again (and will post it in the Thread of course)... :idea:
(It was working in v8.8.2 for FF (+PM26) and v8.9.7 for FF (+FF55), both on Win10_x64...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
rapieragnay
Posts: 11
Joined: Sun Jan 24, 2021 11:06 am

Re: Fill Facebook forms with javascript and imacros

Post by rapieragnay » Tue Feb 02, 2021 2:18 am

chivracq wrote:
Mon Feb 01, 2021 4:52 am
Some Quick Update for @OP, I had seen you had mentioned your FCI on your SOF Thread..., that you've since deleted, which is usually a Show-Stopper for me
I deleted the post on SOF because someone began to make downvoting on it. And finally I don't want to attract facebook's gaze on that :D
But I can put it back if needed
chivracq wrote:
Mon Feb 01, 2021 4:52 am
OK, was not difficult to do, took me less than 3 min "then"..., was based on using the FB-Mobile Version... :idea:
Of course, I already thought about taking the mobile version (m.facebook.com). It's easier to work on it, but ultimately the real situation is in another form (/marketplace/create). And it turns out that the mobile version has a little difference (no tag fields). Which led me to look for the solution while staying on the standard version.

By the way I already have a script that works when you leave the browser alone, but my goal was to find a trick that allows you to choose dropdown safely (because it disappears when it loses focus). I take as an example the script runs in the browser while I hit the keyboard trying to write some texts in Notepad.
Post Reply