自动化神器Playwright-python(3)-设备仿真
playwright可通过浏览器的设备仿真技术, 测试移动端应用
设备仿真
代码语言:javascript复制from playwright.sync_api import sync_playwright
from loguru import logger
def run():
with sync_playwright() as pw:
# 获取设备配置信息
iphone14 = pw.devices['iPhone 14']
# 初始化一个设备环境, 打开页面
browser = pw.chromium.launch(headless=False)
context = browser.new_context(**iphone14)
page = context.new_page()
page.goto("http://baidu.com")
page.pause()