简体   繁体   English

Pyppeteer 用于级联下拉框?

[英]Pyppeteer for cascading drop down box?

I use python and pyppeteer to craw web page and stucked.我使用 python 和 pyppeteer 抓取 web 页面并卡住。

A page with 2 Drop down boxs A and B. B's select item is based on A's selection (items retrieved dynamic).带有 2 个下拉框 A 和 B 的页面。B 的 select 项目基于 A 的选择(检索的项目是动态的)。

my code list list below but do not work我的代码列表如下但不起作用

await page.select("select#ListA", "ItemA")
await page.waitFor(1000)
await page.select("select#ListB", "ItemA1")       
await page.waitFor(1000)

I have tried either await page.waitForNavigation() or page.waitForSelector(), but all fails.我尝试过 await page.waitForNavigation() 或 page.waitForSelector(),但都失败了。

Did I missing anything?我错过了什么吗?

Any comment are appreciate !任何评论表示赞赏!

It's hard to tell without seeing the website, but it's possible that your code fails because of the old version Chrome that pyppeteer specifies.不看网站很难判断,但你的代码可能会因为pyppeteer指定的旧版本 Chrome 而失败。 You may want to try out pyppeteer2 (disclaimer: I'm one of the main developers), which is working to update the years abandoned library.您可能想尝试pyppeteer2 (免责声明:我是主要开发人员之一),它正在努力更新多年废弃的库。

Another thing you could try is launching in headless mode and see exactly what is happening.您可以尝试的另一件事是在无头模式下启动并查看到底发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM