Trying to locate an element on facebook

Hello

I am trying to figure out how to write comment on facebook group post.

I managed to create a working (albeit buggy) macro with the help of XTYPE. But i like to learn how to locate an element and type without using XTYPE or XCLICK.

Anyway let me show you how my macro that uses XTYPE works

Open https://www.facebook.com/groups/1111111111111/permalink/22222222222222/
click //div[@contenteditable="true"]
xtype TEST ${KEY_ENTER}

This works, but I need to close the KANTU windows immediately after starting the macro. Because XTYPE needs an foreground window. Also when running the macro loop I see these “Unable to comment” error followed by some “Loading dialog” for a moment until it runs the next command. Macro 100% works, but it looks ugly when running the macro.

So i like to create a better one.

As you can see from my inspect element screenshot that facebook comment area has a bunch of randomized names like _39-c, 7C_R, etc. But this contenteditable=“true” is always there. That’s why i used it to click on the comment area.

But when i try to use following commands

Command: TYPE 
Target: //div[@contenteditable="true"
Value: TEST TEXT

run command: element found is neither input nor textarea

I wasn’t able to find an input/text area by looking through inspect element.

Please help. Thank you!!

You can add BringBrowserToForeground to your macro.

Yeah, Facebook is very tricky (or impossible?) to automate with the classic selenium ide commands. The fb page uses all kinds of techniques to make web driver automation as difficult as possible (same is true for instagram). So I would continue to use xtype and xclick with image as input.

Is this an error on the facebook page?

1 Like

You can add BringBrowserToForeground to your macro.

Nice. Working great! Now i don’t have to do it manually.

Yeah, Facebook is very tricky (or impossible?) to automate with the classic selenium ide commands. The fb page uses all kinds of techniques to make web driver automation as difficult as possible (same is true for instagram). So I would continue to use xtype and xclick with image as input .

Yeah i heard that FB tries to make them hard for automation. But I think it seems possible given that some people on imacro forum is trying to sell various macros for Facebook like Auto comment, auto post, delete/upload photos, unban groups members etc. I just like to create a proper one for auto comment on group posts.

Is this an error on the facebook page?

Thank you!

Could this be simply a timing issue? In other words, you (the macro) are posting comments too fast? As a test, try adding PAUSE 5000 (5 seconds) or simply run the complete macro in slow speed.

Saya ingin menambah teman di facebook dan memgirim pesan pribadi, bagaimanakah format perintahnya?