mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
docs: fix the python cdp snippet (#7324)
This commit is contained in:
parent
9f3bccc200
commit
550b48f958
@ -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
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user