Overview
Playwright provides comprehensive mobile emulation capabilities, allowing you to test mobile web applications without physical devices. Test responsive designs, touch interactions, and mobile-specific features across different device configurations.Device Emulation
Using Predefined Devices
Playwright includes a registry of popular devices:Available Device Profiles
Configure Mobile Projects
Test across multiple devices in your configuration:Custom Device Configuration
Create Custom Device Profile
Define custom viewport and device characteristics:Viewport Configuration
1
Set viewport size
2
Get current viewport
3
Test responsive breakpoints
Mobile-Specific Features
Touch Events
Simulate touch interactions:Geolocation
Set device location:Device Orientation
Network Conditions
Simulate Mobile Networks
Emulate slow mobile networks:Practical Examples
Responsive Navigation Menu
Mobile Form Testing
Testing Pull-to-Refresh
CI/CD Configuration
Test mobile configurations in CI pipelines:Best Practices
- Test popular devices: Focus on devices your users actually use (check analytics)
- Test both orientations: Ensure your app works in portrait and landscape modes
- Test touch interactions: Mobile users interact differently than desktop users
- Test with slow networks: Many mobile users have unreliable connections
- Use device-specific user agents: Some sites serve different content based on user agent
- Test mobile-specific features: Camera access, geolocation, device orientation, etc.
Device emulation provides good approximation but cannot replicate all aspects of real devices, such as GPU performance or specific browser engine quirks.
Troubleshooting
Touch events not working
EnsurehasTouch is enabled:
