-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Version
1.55.0
Steps to reproduce
- open the target url in chromium, mock iPhone 13
from playwright.sync_api import sync_playwright, Playwright
iphone_13 = playwright.devices['iPhone 13']
browser = playwright.chromium.launch(headless=False)
context = browser.new_context(
**iphone_13,
)
page = context.new_page()
url = "https://m.toutiao.com/video/7578574827087216640"
page.goto(url)
- try to scroll to next video in this page by mouse or pan by locator, like below
def pan(locator, deltaX=0, deltaY=0, steps=5):
bounds = locator.bounding_box()
centerX = bounds['x'] + bounds['width'] / 2
centerY = bounds['y'] + bounds['height'] / 2
touches = [{
'identifier': 0,
'clientX': centerX,
'clientY': centerY,
}]
locator.dispatch_event('touchstart', {
'touches': touches,
'changedTouches': touches,
'targetTouches': touches
})
for i in range(1, steps + 1):
touches = [{
'identifier': 0,
'clientX': centerX + deltaX * i / steps,
'clientY': centerY + deltaY * i / steps,
}]
locator.dispatch_event('touchmove', {
'touches': touches,
'changedTouches': touches,
'targetTouches': touches
})
locator.dispatch_event('touchend')
- ignore the video can not play error,
Expected behavior
- I can scroll to next video
Actual behavior
- can not scroll to next video
mock iPhone13
is_mobile: True
has_touch: True
2.debug by F12, when i scroll, only MouseDown event, no TouchStart event
Additional context
1.when i mock iPhone13 by chrome: F12 -- Toggle device toolbar -- select iPhone 13 or any other device, i can scroll to next video. so it is mostly sitll web mode when use playwright mock iPhone13
Environment
- Operating System: [window10]
- CPU: [arm64]
- Browser: [Chrome, Chromium, WebKit]
- Python Version: [3.10]
- Other info:
Metadata
Metadata
Assignees
Labels
No labels