facing issue ! things working at popup web page and type tweet it stuck at the point where it has to enter tweet
Closed this issue · 1 comments
i get error of timeout
tweet content here => testing tweeet
D:\hamza qureshi work\tweetfree\node_modules\puppeteer-core\lib\cjs\puppeteer\common\WaitTask.js:65
this.terminate(new Errors_js_1.TimeoutError(Waiting failed: ${options.timeout}ms exceeded
));
^
TimeoutError: Waiting for selector .//*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[3]/div/div[2]/div[1]/div/div/div/div[2]/div[3]/div/div/div[2]/div[3]
failed: Waiting failed: 30000ms exceeded
at Timeout. (D:\hamza qureshi work\tweetfree\node_modules\puppeteer-core\lib\cjs\puppeteer\common\WaitTask.js:65:32)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
it is because in tweet fucntion
async tweet({ content }) {
const activeURL = await this.page.url();
const url = https://twitter.com/home
;
if (activeURL !== url) await this.page.goto(url);
await this.page.waitForXPath(this.xpaths.tweet_div);
const tweetModal = await this.page.$x(this.xpaths.tweet_modal);
await tweetModal[0].click()
await tweetModal[0].type(content, this.defaultType)
console.log('tweet content here => ',content)
const nextButton = await this.page.waitForXPath(this.xpaths.tweet_enter, { visible: true }); // AT THIS LINE
console.log('tweet enter button => ',nextButton)
await nextButton.click();
await this.sleep(500);
}
it is unable to get nextButton
const nextButton = await this.page.waitForXPath(this.xpaths.tweet_enter, { visible: true });
can you please check is their any update cause that issue
It's because Twitter has updated their HTML structure, invalidating the xpaths. Sadly this repository is no longer maintained.
You can fix it by opening Twitter in your browser and copying the new xpaths using the Inspect Element tool