docs: fix the python cdp snippet (#7324)

This commit is contained in:
Pavel Feldman 2021-06-25 11:53:55 -07:00 committed by GitHub
parent 9f3bccc200
commit 550b48f958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,23 +25,23 @@ await client.send('Animation.setPlaybackRate', {
```python async ```python async
client = await page.context().new_cdp_session(page) client = await page.context().new_cdp_session(page)
await client.send("animation.enable") await client.send("Animation.enable")
client.on("animation.animation_created", lambda: print("animation created!")) client.on("Animation.animationCreated", lambda: print("animation created!"))
response = await client.send("animation.get_playback_rate") response = await client.send("Animation.getPlaybackRate")
print("playback rate is " + response["playback_rate"]) print("playback rate is " + response["playbackRate"])
await client.send("animation.set_playback_rate", { await client.send("Animation.setPlaybackRatee", {
playback_rate: response["playback_rate"] / 2 playback_rate: response["playbackRate"] / 2
}) })
``` ```
```python sync ```python sync
client = page.context().new_cdp_session(page) client = page.context().new_cdp_session(page)
client.send("animation.enable") client.send("Animation.enable")
client.on("animation.animation_created", lambda: print("animation created!")) client.on("Animation.animationCreated", lambda: print("animation created!"))
response = client.send("animation.get_playback_rate") response = client.send("Animation.getPlaybackRate")
print("playback rate is " + response["playback_rate"]) print("playback rate is " + response["playbackRate"])
client.send("animation.set_playback_rate", { client.send("Animation.setPlaybackRate", {
playback_rate: response["playback_rate"] / 2 playback_rate: response["playbackRate"] / 2
}) })
``` ```