microsoft / playwright-java

Java version of the Playwright testing and automation library
https://playwright.dev/java/
Apache License 2.0
1.16k stars 209 forks source link

[Bug]: Webkit Mobile View: Stream error in the HTTP/2 framing layer: Facing this issue upon opening https://www.redbus.in #1667

Closed Krishna-D-Hegde closed 2 months ago

Krishna-D-Hegde commented 2 months ago

Version

1.46.0

Steps to reproduce

Playwright playwright = Playwright.create(); Browser browser = playwright.webkit().launch(new BrowserType.LaunchOptions().setHeadless(false)); BrowserContext context = browser.newContext( new Browser.NewContextOptions() .setViewportSize(414, 896) // iPhone 12 viewport size .setDeviceScaleFactor(3) // Device pixel ratio .setUserAgent("Mozilla/5.0 (iPhone14,6; U; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/19E241 Safari/602.1") // iPhone 12 user agent .setHasTouch(true) // Enable touch events .setIgnoreHTTPSErrors(true) // Optional: ignore HTTPS issues if applicable .setExtraHTTPHeaders(Map.of("connection", "close")) // Disable HTTP/2 .setIsMobile(true) // Set to true for mobile );
Page page = context.newPage(); page.navigate("https://www.redbus.in");

Expected behavior

https://www.redbus.in should open in Webkit Mobile View

Actual behavior

Works for Chromium Mobile view and Firefox Mobile view but not working for Webkit Mobile view

Additional context

No response

Environment

Windows - Webkit

mxschmitt commented 2 months ago

Sorry for the late reply. Minimal reproducible for Node.js:

const { webkit } = require('playwright');

(async () => {
  const browser = await webkit.launch({ headless: false });

  const context = await browser.newContext({
    userAgent: "Mozilla/5.0 (iPhone14,6; U; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/19E241 Safari/602.1", // iPhone 12 user agent
  });

  const page = await context.newPage();
  await page.goto("https://www.redbus.in");

})();

with cURL:

curl -A "Mozilla/5.0 (iPhone14,6; U; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/19E241 Safari/602.1" -v https://www.redbus.in

same happens also with an original iOS User-Agent:

curl -A "Mozilla/5.0 (iPhone; CPU iPhone OS 17_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Mobile/15E148 Safari/604.1" -v  https://www.redbus.in

Since the server looks like misbehaving on http2 we can't do much on that end. I recommend to contact the server administrators if you own that web property.

mxschmitt commented 2 months ago

Closing as per above, since it also doesn't work with cURL. So the web server is definitely broken or returns invalid http2. I recommend to use a different user-agent as workaround.