【问题标题】:Is there any other way so that i can get rid of this problem as my page.click() function is not working有没有其他方法可以让我摆脱这个问题,因为我的 page.click() 函数不起作用
【发布时间】:2020-06-02 03:19:33
【问题描述】:

我正在尝试抓取 OLX 汽车数据,但我无法点击加载更多。

两个代码都不起作用

await page.click('#container > main > div > section > div > div > div:nth-child(7) > div._3etsg > div > div.JbJAl > button')
await page.evaluate(()=>document.querySelector('#container > main > div > section > div > div > div:nth-child(7) > div._3etsg > div > div.JbJAl > button').click())

【问题讨论】:

  • 你能发布更多你的代码吗?看到您的通话内容会有很大帮助!

标签: javascript web-scraping puppeteer


【解决方案1】:

您的选择器有一些错误,此代码在 https://www.olx.in 上为我工作

await page.click("#container > main > div > section > div > div > div > div.JbJAl > button");

你能检查一下这是否有效吗?

【讨论】:

    猜你喜欢
    • 2021-09-06
    • 1970-01-01
    • 1970-01-01
    • 2021-05-10
    • 1970-01-01
    • 2021-12-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多