- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
在Python中,使用pyppeteer,我打开一个网页并在其控制台中运行JS脚本并尝试捕获结果在变量中,但我收到以下错误。
Traceback (most recent call last):
File "/home/ndaruto/anaconda3/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/naruto/anaconda3/lib/python3.7/site-packages/django/utils/deprecation.py", line 96, in __call__
response = self.process_response(request, response)
File "/home/naruto/anaconda3/lib/python3.7/site-packages/django/middleware/clickjacking.py", line 26, in process_response
if response.get('X-Frame-Options') is not None:
AttributeError: 'coroutine' object has no attribute 'get'
/home/naruto/anaconda3/lib/python3.7/pathlib.py:704: RuntimeWarning: coroutine 'hmm' was never awaited
return self._str
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
下面是 python 代码:-
async def hmm(request):
browser = await launch()
page = await browser.newPage()
await page.goto('http://jobs.chegg.com')
ans = await page.evaluate('''() => {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/axe-core/3.1.2/axe.min.js';
document.head.appendChild(script);
setTimeout(function(){
axe.run(document, {
runOnly: {
type: "tag",
values: ["wcag2a", "wcag2aa", "best-practice"]
},
"rules": {
"skip-link": { enabled: false }
}
}, function(err, results) {
if (err) throw err;
console.log(results);
});
}, 1000);
}''')
print("ANS IS", ans)
return 1
有人可以建议如何解决这个问题吗?
最佳答案
AttributeError:“coroutine”对象没有属性“get”
这意味着你打电话
/home/naruto/anaconda3/lib/python3.7/pathlib.py:704:RuntimeWarning:从未等待协程“hmm”嗯(请求).get()
相反r = 等待嗯(请求)
r.get()
在你的代码中围绕这个函数的某个地方
关于python - “coroutine”对象没有属性 get || pyppeteer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59927874/
我想使用身份验证代理运行 Chrome 浏览器。我有这个代码,但 Chrome 不通过代理连接。请问有什么建议吗? import asyncio from pyppeteer import launc
我正在尝试接受在此 page 上生成的弹出窗口上的 cookie 同意。 。我尝试使用 waitForSelector 但我使用的选择器似乎对 headless 浏览器不可见。我想实际上切换到"is"
我在做一些测试,我想知道下面的脚本是否在异步运行? # python test.py It took 1.3439464569091797 seconds. 31(站点)x 1.34 = 41.54
Pyppeteer简介 介绍Pyppeteer之前先说一下Puppeteer,Puppeteer是谷歌出品的一款基于Node.js开发的一款工具,主要是用来操纵Chrome浏览器的 API,通过J
我正在尝试 刮 本站数据https://quickfs.net/company/BABA:US使用 pyppeteer,没有这个网站就会知道我在抓取。 所以我的第一个问题是: 将 pyppeteer
因此,如果我使用 await page.waitFor(9000) 或一些硬编码的等待号码,我的函数将等到页面加载。 但是,await page.goto(url, {'waitUntil': 'ne
我最近在 heroku 中部署了一个应用程序。它使用 python pyppeteer 包。我在 repl.it 上测试时没有遇到任何问题。但不幸的是,在 heroku 中,浏览器不断崩溃。 我使用
我想使用 pyppeteer 连接到现有的(已由用户打开,没有任何额外标志)Chrome 浏览器这样我就可以控制它了。 我之前几乎可以执行所有手动操作(例如,在现有 chrome 中启用远程 Debu
我正在尝试将使用 puppeteer 的节点项目迁移到使用 pyppeteer 的 python 项目。 我有下面的 javascript 查询,它工作正常。 const values = await
我用pyppeteer做了一个测试,爬虫淘宝网。淘宝网有识别代码,就是 slider 按钮,所以我在代码中添加了一些方法。但代码运行时发生了错误。错误信息如下: 2018-11-30 18:15:32
我用 python 结合 pyppeteer 编写了一个脚本,用于从网页上抓取不同咖啡馆的名称及其电话号码。虽然我下面尝试的方法达到了目的,但脚本看起来确实很困惑。使用 pyppeteer 库创建 f
在Python中,使用pyppeteer,我打开一个网页并在其控制台中运行JS脚本并尝试捕获结果在变量中,但我收到以下错误。 Traceback (most recent call last):
我有两个问题暂时无法解决。 1. 我想让浏览器保持运行状态,这样我就可以使用 pyppeteer.launcher.connect() 重新连接函数,但即使我不调用 pyppeteer.browser
今天,我学习了名为 pyppeteer 的库,当我运行我的代码时 import asyncio from pyppeteer import launch async def main(): b
我想使用pyppeteer单击以下按钮 Text here 我正在尝试使用 Jquery 来完成此操作,如建议的 here : btn = await page.querySelector('butt
我用 python 结合 pyppeteer 和 asyncio 编写了一个脚本,从其登陆页面抓取不同帖子的链接,并最终获得每个帖子的标题通过跟踪通向其内页的 url 来发布。我这里解析的内容不是动态
我正在尝试登录一个网站,单击一个按钮,然后抓取一些数据。必须呈现页面,因为它全部使用 JavaScript(因此如果您 [例如] 在 Web 浏览器中查看源代码,则不可用)。 除了发送点击的时间外,一
我在 AWS Lambda 中遇到了这个错误。似乎 devtools websocket 没有启动。不知道如何修复它。有任何想法吗?谢谢你的时间。 由于 websocket 响应超时 https://
如何在 Puppeteer 中禁用图像/CSS? 我看过这个教程 https://www.scrapehero.com/how-to-increase-web-scraping-speed-using
我想抓取一个网站,但在使用 Recaptcha 时遇到困难。我已经找到了解决该问题的方法,但在该方法开始之前,我必须确保 Recaptcha 已完全加载,这就是我所坚持的。我试过page.waitFo
我是一名优秀的程序员,十分优秀!