问题
I need help please
I try to leave a comment on posts using PUPPETEER,
I can find the post but I can not respond to the same post.
it finds me all the posts and it's not good for me,
basically what I want to do is:
- SCROLL DOWN
- Search for a post
- Respond to him
For example:
Someone wrote: "I am looking for a job"
Then I will respond to him "Send me a message and I will be happy to help you!"
I would be very happy for anyone who can help me.
enclose here some of my code I wrote + screenshot of the code
const navigationPromise = page.waitForNavigation();
//await page.reload()
await page.goto("https://www.facebook.com/groups/138463796814322/") //"מחפשת עבודה"
await page.waitForSelector("div[aria-hidden='true']");
await page.evaluate(_ => {
window.scrollBy(0, window.innerHeight);
});
await page.waitForTimeout(2000);
let elements= await page.evaluate(() => {
return [...document.querySelectorAll("div[aria-hidden='true']")].filter(element => element.textContent.includes("looking for job"));
});
if (elements.length)
{
for (let i=0;i<elements.length;i++)
{
let firebug3class = await page.$$('div._1mf._1mj');
await page.waitForTimeout(5000);
await firebug3class[1]?.type('looking for job? talk to me :) i help you');
}
//כל מי שמחפשת תלחץ קליק
//ותגיב לה שלחי לי ווצאפ
elements[comment]?.click();
}
SCREEN SHOOT WHAT I WANT TO DO
CLICK HERE
来源:https://stackoverflow.com/questions/66070005/leave-a-comment-to-post-in-facebook-with-puppteer