Post comments on Facebook page via console

前端 未结 5 1139
说谎
说谎 2021-02-06 04:10

Like in the image, the Facebook comment box has no submit button, when you write something and press Enter button, the comment posted.

I want to submit the comment via J

5条回答
  •  礼貌的吻别
    2021-02-06 04:22

    as I wasn't able to post comments through the "normal" facebook page, I remembered that they also have the mobile version, which is on m.facebook. com, there, they still have the submit Button, so depending on your needs, this may be a good option

    so, you could go to the mobile facebook post (eg https://m.facebook.com/${author}/posts/${postId}) and do

    // Find the input element that saves the message to be posted
    document.querySelector("input[name='comment_text']").value='MESSAGE TO POST';
    // find the submit button, enable it and click it
    const submitButton = document.querySelector("button[name='submit']");
    submitButton.disabled = false;
    submitButton.click();
    

提交回复
热议问题