我的文件上传中有什么错误? (剧作家)
我面对一个问题,即我的文件没有被上传到网站,这是一个代码:
await mainPage.clickElement('locator for the element "Add logo"');
page.on('filechooser', async (fileChooser) => {
await fileChooser.setFiles('path to jpg file');
});
我正在使用“@playwright/test”:“^1.19.2”, 为什么它不起作用,怎么了?
这是一个dom:
https://i.sstatic.net/73q48.png
await mainPage.clickElement('locator for the element "Add logo"');
是一个简单的page.click(),仅在pageObject中使用
I'm facing with an issue that my files are not being uploaded to website, here is a code:
await mainPage.clickElement('locator for the element "Add logo"');
page.on('filechooser', async (fileChooser) => {
await fileChooser.setFiles('path to jpg file');
});
I'm using "@playwright/test": "^1.19.2",
why it is not working, what's wrong?
Here is a DOM:
https://i.sstatic.net/73Q48.png
UPD:
await mainPage.clickElement('locator for the element "Add logo"');
is a simple page.click(), just used from PageObject
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的比赛状况。我建议使用
WaitforeVent
函数:You are having a race condition. I recommend using the
waitForEvent
function instead: