问题描述
我正在尝试通过 puppeteer 在电报中上传图像和视频。 我使用 fileChooser 作为电报系统不使用 。
const media = ["path/to/files"]
// clicks the "attachment" button,so,the file upload dialog opens.
const button = await this.page.$('button[title="Add an attachment"]')
await button.click()
await sleep(1000)
// uploads the files
const [fileInput] = await Promise.all([
this.page.waitForFileChooser(),this.page.click(itemSelector)
])
await fileInput.accept(media)
// presses Enter on input Box to send the post
const textarea = await this.page.waitForSelector("div#editable-message-text-modal",{ timeout: 0 });
await textarea.focus()
await textarea.press("Enter")
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)