microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.42k stars 3.63k forks source link

[BUG] page.goto doesn't work on headed mode #13156

Closed christophebe closed 2 years ago

christophebe commented 2 years ago

Context:

Code Snippet

It doesn't work on my M1. The url is just an example. There are other urls that don't work.

const browser = await chromium.launch({ headless: false })
const page = await browser.newPage()

  try {
    await page.goto('https://www.belfius.be/', { waitUntil: 'networkidle' })
    console.log('seems to be ok')
  } catch (error) {
    console.log(error)
  } finally {
    browser.close()
  }

In headless mode, it works

const browser = await chromium.launch({ headless: true })
  const page = await browser.newPage()

  try {
    await page.goto('https://www.belfius.be/', { waitUntil: 'networkidle' })
    console.log('seems to be ok')
  } catch (error) {
    console.log(error)
  } finally {
    browser.close()
  }

Describe the bug In the headed mode, I got a time out : page.goto: Timeout 30000ms exceeded.

rwoll commented 2 years ago

Thanks for your report!

Never use networkidle! It depends on network conditions and timing, and is therefore flaky. (I ran your tests above 60 times on an M1, and they all worked.)

Playwright will auto wait, so just skip to the bits where you interact with the page:

await page.goto('https://www.belfius.be/');
await page.locator('text=My Button').click();

If you need to gate things more manually (or don't want to click), you can wait for specific elements via https://playwright.dev/docs/api/class-locator#locator-wait-for or specific network calls via https://playwright.dev/docs/api/class-page#page-wait-for-request.

Does that resolve your issue? If not, please let us know and include more context on your use case.

christophebe commented 2 years ago

Hi,

Thanks for your answer ! removing networkidle doesn't solve the issue. I still have a timeout only when headless = false. If true, it works fine with Chromium.

I tested with Firefox instead of Chromium and it works fine with the same site when headless = false I don't understand :-)

Maybe a Chromium config ?

Thanks

christophebe commented 2 years ago

I got exactly the same issue in Python. With the same site and with headless=False

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    page = browser.new_page()
    page.goto("https://www.belfius.be/")
    print(page.title())
    browser.close()

I don't understand why is working for some sites and not for others.

rwoll commented 2 years ago

@christophebe Since it's hitting a live page there could be a lot of factors at play. Can you please reproduce with DEBUG=pw:* API set. It should print out logs. Please share the logs and we can help debug further!

(You can also try using the Trace Viewer to debug: https://playwright.dev/docs/trace-viewer)

christophebe commented 2 years ago

@rwoll

Here is the log. Thanks a lot !

pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/Users/christophelombart/Library/Caches/ms-playwright/chromium-978106/chrome-mac/Chromium.app/Contents/MacOS/Chromium',
  pw:channel:event       name: 'chromium'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@c4820a91ce7b48c09d099d124bde4390'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/Users/christophelombart/Library/Caches/ms-playwright/firefox-1319/firefox/Nightly.app/Contents/MacOS/firefox',
  pw:channel:event       name: 'firefox'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@bf7cb740065d592995e044b6738111ce'
  pw:channel:event   }
  pw:channel:event } +2ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserType',
  pw:channel:event     initializer: {
  pw:channel:event       executablePath: '/Users/christophelombart/Library/Caches/ms-playwright/webkit-1616/pw_run.sh',
  pw:channel:event       name: 'webkit'
  pw:channel:event     },
  pw:channel:event     guid: 'browser-type@52d09ae87ad845ec9bdcbc9d097e95c2'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Android',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'android@7fbbc49104ef0789f400547c21443345'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Electron',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'electron@31d51ccc49ed2e8397363b4f6289a486'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'LocalUtils',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'localUtils@ab8f59b59189b6296041ef09a0b84aa9'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Selectors',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'selectors@3212cda3e9bd42fbde3e6c9ee1810764'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: '',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Playwright',
  pw:channel:event     initializer: {
  pw:channel:event       chromium: [Object],
  pw:channel:event       firefox: [Object],
  pw:channel:event       webkit: [Object],
  pw:channel:event       android: [Object],
  pw:channel:event       electron: [Object],
  pw:channel:event       utils: [Object],
  pw:channel:event       deviceDescriptors: [Array],
  pw:channel:event       selectors: [Object],
  pw:channel:event       preLaunchedBrowser: undefined,
  pw:channel:event       socksSupport: undefined
  pw:channel:event     },
  pw:channel:event     guid: 'Playwright'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:api => browserType.launch started +0ms
  pw:channel:command {
  pw:channel:command   id: 1,
  pw:channel:command   guid: 'browser-type@c4820a91ce7b48c09d099d124bde4390',
  pw:channel:command   method: 'launch',
  pw:channel:command   params: { ignoreAllDefaultArgs: false, headless: false }
  pw:channel:command } +0ms
  pw:browser <launching> /Users/christophelombart/Library/Caches/ms-playwright/chromium-978106/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --enable-use-zoom-for-dsf=false --no-sandbox --user-data-dir=/var/folders/kd/307tf1f930dg6b1hpn74c77h0000gn/T/playwright_chromiumdev_profile-U5Hlpz --remote-debugging-pipe --no-startup-window +0ms
  pw:browser <launched> pid=30982 +4ms
  pw:protocol SEND ► {"id":1,"method":"Browser.getVersion"} +0ms
  pw:browser [pid=30982][err] objc[30993]: Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x24c4d31a8) and /Users/christophelombart/Library/Caches/ms-playwright/chromium-978106/chrome-mac/Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/101.0.4929.0/Libraries/libGLESv2.dylib (0x1098a9550). One of the two will be used. Which one is undefined. +546ms
  pw:protocol ◀ RECV {"id":1,"result":{"protocolVersion":"1.3","product":"Chrome/101.0.4929.0","revision":"@110dd5afedc7ef6846418b5df65fcc2c456184e0","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4929.0 Safari/537.36","jsVersion":"10.1.69"}} +548ms
  pw:protocol SEND ► {"id":2,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":true,"flatten":true}} +1ms
  pw:protocol ◀ RECV {"id":2,"result":{}} +1ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-type@c4820a91ce7b48c09d099d124bde4390',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Browser',
  pw:channel:event     initializer: { version: '101.0.4929.0', name: 'chromium' },
  pw:channel:event     guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab'
  pw:channel:event   }
  pw:channel:event } +562ms
  pw:channel:response {
  pw:channel:response   id: 1,
  pw:channel:response   result: { browser: { guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab' } }
  pw:channel:response } +0ms
  pw:api <= browserType.launch succeeded +561ms
  pw:api => browser.newPage started +1ms
  pw:channel:command {
  pw:channel:command   id: 2,
  pw:channel:command   guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab',
  pw:channel:command   method: 'newContext',
  pw:channel:command   params: { noDefaultViewport: false }
  pw:channel:command } +562ms
  pw:protocol SEND ► {"id":3,"method":"Target.createBrowserContext","params":{"disposeOnDetach":true}} +3ms
  pw:protocol ◀ RECV {"id":3,"result":{"browserContextId":"25A5F54FA26E46F079170C5F39F67A1A"}} +2ms
  pw:protocol SEND ► {"id":4,"method":"Browser.setDownloadBehavior","params":{"behavior":"allowAndName","browserContextId":"25A5F54FA26E46F079170C5F39F67A1A","downloadPath":"/var/folders/kd/307tf1f930dg6b1hpn74c77h0000gn/T/playwright-artifacts-2OfoAP","eventsEnabled":true}} +1ms
  pw:protocol ◀ RECV {"id":4,"result":{}} +0ms
  pw:channel:event {
  pw:channel:event   guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Tracing',
  pw:channel:event     initializer: {},
  pw:channel:event     guid: 'Tracing@cd29d7b91a894ba43315afe666d6615e'
  pw:channel:event   }
  pw:channel:event } +7ms
  pw:channel:event {
  pw:channel:event   guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'APIRequestContext',
  pw:channel:event     initializer: { tracing: [Object] },
  pw:channel:event     guid: 'fetchRequest@4d9eed5ee01a0168888fc90c71d8829d'
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'BrowserContext',
  pw:channel:event     initializer: {
  pw:channel:event       isChromium: true,
  pw:channel:event       APIRequestContext: [Object],
  pw:channel:event       tracing: [Object]
  pw:channel:event     },
  pw:channel:event     guid: 'browser-context@102a6e6334eca2f7608830a922204f74'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:response {
  pw:channel:response   id: 2,
  pw:channel:response   result: {
  pw:channel:response     context: { guid: 'browser-context@102a6e6334eca2f7608830a922204f74' }
  pw:channel:response   }
  pw:channel:response } +7ms
  pw:api <= browser.newPage succeeded +6ms
  pw:api => browser.newPage started +0ms
  pw:channel:command {
  pw:channel:command   id: 3,
  pw:channel:command   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:command   method: 'newPage',
  pw:channel:command   params: undefined
  pw:channel:command } +6ms
  pw:protocol SEND ► {"id":5,"method":"Target.createTarget","params":{"url":"about:blank","browserContextId":"25A5F54FA26E46F079170C5F39F67A1A"}} +3ms
  pw:protocol ◀ RECV {"method":"Target.attachedToTarget","params":{"sessionId":"B948B16D59A9CD517144E2F07B179082","targetInfo":{"targetId":"C52202D4B739564FFB365DA92230C91E","type":"page","title":"","url":"about:blank","attached":true,"canAccessOpener":false,"browserContextId":"25A5F54FA26E46F079170C5F39F67A1A"},"waitingForDebugger":true}} +83ms
  pw:protocol SEND ► {"id":6,"method":"Browser.getWindowForTarget","sessionId":"B948B16D59A9CD517144E2F07B179082"} +1ms
  pw:protocol ◀ RECV {"id":5,"result":{"targetId":"C52202D4B739564FFB365DA92230C91E"}} +9ms
  pw:protocol ◀ RECV {"id":6,"result":{"windowId":1,"bounds":{"left":22,"top":60,"width":1200,"height":1035,"windowState":"normal"}},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +249ms
  pw:protocol SEND ► {"id":7,"method":"Page.enable","sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":8,"method":"Page.getFrameTree","sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":9,"method":"Log.enable","params":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":10,"method":"Page.setLifecycleEventsEnabled","params":{"enabled":true},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":11,"method":"Runtime.enable","params":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +1ms
  pw:protocol SEND ► {"id":12,"method":"Page.addScriptToEvaluateOnNewDocument","params":{"source":"","worldName":"__playwright_utility_world__"},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":13,"method":"Network.enable","sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":14,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":true,"flatten":true},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":15,"method":"Emulation.setFocusEmulationEnabled","params":{"enabled":true},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":16,"method":"Emulation.setDeviceMetricsOverride","params":{"mobile":false,"width":1280,"height":720,"screenWidth":1280,"screenHeight":720,"deviceScaleFactor":1,"screenOrientation":{"angle":90,"type":"landscapePrimary"}},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":17,"method":"Browser.setWindowBounds","params":{"windowId":1,"bounds":{"width":1282,"height":800}},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":18,"method":"Emulation.setEmulatedMedia","params":{"media":"","features":[{"name":"prefers-color-scheme","value":"light"},{"name":"prefers-reduced-motion","value":"no-preference"},{"name":"forced-colors","value":"none"}]},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":19,"method":"Runtime.runIfWaitingForDebugger","sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":17,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +3ms
  pw:protocol ◀ RECV {"id":7,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +80ms
  pw:protocol ◀ RECV {"id":8,"result":{"frameTree":{"frame":{"id":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","url":"about:blank","domainAndRegistry":"","securityOrigin":"://","mimeType":"text/html","adFrameStatus":{"adFrameType":"none"},"secureContextType":"InsecureScheme","crossOriginIsolatedContextType":"NotIsolated","gatedAPIFeatures":[]}}},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol SEND ► {"id":20,"method":"Page.createIsolatedWorld","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","grantUniveralAccess":true,"worldName":"__playwright_utility_world__"},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +1ms
  pw:protocol ◀ RECV {"id":9,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","name":"commit","timestamp":36708.670551},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","name":"DOMContentLoaded","timestamp":36708.67063},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","name":"load","timestamp":36708.673207},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","name":"networkAlmostIdle","timestamp":36708.675533},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","name":"networkIdle","timestamp":36708.675533},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":10,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"context":{"id":1,"origin":"://","name":"","uniqueId":"-5341451335804414185.4468257835436916133","auxData":{"isDefault":true,"type":"default","frameId":"C52202D4B739564FFB365DA92230C91E"}}},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":11,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":12,"result":{"identifier":"1"},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +1ms
  pw:protocol ◀ RECV {"id":13,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":14,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":15,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Page.frameResized","params":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":16,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":18,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"id":19,"result":{},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Frame',
  pw:channel:event     initializer: {
  pw:channel:event       url: 'about:blank',
  pw:channel:event       name: '',
  pw:channel:event       parentFrame: undefined,
  pw:channel:event       loadStates: [Array]
  pw:channel:event     },
  pw:channel:event     guid: 'frame@6bb1251e6f8360f6eb719f8a7a111d1d'
  pw:channel:event   }
  pw:channel:event } +429ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Page',
  pw:channel:event     initializer: {
  pw:channel:event       mainFrame: [Object],
  pw:channel:event       viewportSize: [Object],
  pw:channel:event       isClosed: false,
  pw:channel:event       opener: undefined
  pw:channel:event     },
  pw:channel:event     guid: 'page@7700523f5e709a3c7dca2337e9e26e1d'
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: 'page',
  pw:channel:event   params: { page: { guid: 'page@7700523f5e709a3c7dca2337e9e26e1d' } }
  pw:channel:event } +0ms
  pw:channel:response {
  pw:channel:response   id: 3,
  pw:channel:response   result: { page: { guid: 'page@7700523f5e709a3c7dca2337e9e26e1d' } }
  pw:channel:response } +430ms
  pw:api <= browser.newPage succeeded +430ms
  pw:api => page.goto started +0ms
  pw:channel:command {
  pw:channel:command   id: 4,
  pw:channel:command   guid: 'frame@6bb1251e6f8360f6eb719f8a7a111d1d',
  pw:channel:command   method: 'goto',
  pw:channel:command   params: { url: 'https://www.belfius.be/', waitUntil: 'load' }
  pw:channel:command } +430ms
  pw:api navigating to "https://www.belfius.be/", waiting until "load" +1ms
  pw:protocol SEND ► {"id":21,"method":"Page.navigate","params":{"url":"https://www.belfius.be/","frameId":"C52202D4B739564FFB365DA92230C91E"},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +3ms
  pw:protocol ◀ RECV {"method":"Network.requestWillBeSent","params":{"requestId":"2DF7B7877093D0570894EE7BD22C6431","loaderId":"2DF7B7877093D0570894EE7BD22C6431","documentURL":"https://www.belfius.be/","request":{"url":"https://www.belfius.be/","method":"GET","headers":{"Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4929.0 Safari/537.36","sec-ch-ua":"\"(Not(A:Brand\";v=\"8\", \"Chromium\";v=\"101\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"macOS\""},"mixedContentType":"none","initialPriority":"VeryHigh","referrerPolicy":"strict-origin-when-cross-origin","isSameSite":true},"timestamp":36708.75017,"wallTime":1648659056.847938,"initiator":{"type":"other"},"redirectHasExtraInfo":false,"type":"Document","frameId":"C52202D4B739564FFB365DA92230C91E","hasUserGesture":false},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +34ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: '__create__',
  pw:channel:event   params: {
  pw:channel:event     type: 'Request',
  pw:channel:event     initializer: {
  pw:channel:event       frame: [Object],
  pw:channel:event       url: 'https://www.belfius.be/',
  pw:channel:event       resourceType: 'document',
  pw:channel:event       method: 'GET',
  pw:channel:event       postData: undefined,
  pw:channel:event       headers: [Array],
  pw:channel:event       isNavigationRequest: true,
  pw:channel:event       redirectedFrom: undefined
  pw:channel:event     },
  pw:channel:event     guid: 'request@68358544e4bd980870041006768ac73d'
  pw:channel:event   }
  pw:channel:event } +37ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: 'request',
  pw:channel:event   params: {
  pw:channel:event     request: { guid: 'request@68358544e4bd980870041006768ac73d' },
  pw:channel:event     page: { guid: 'page@7700523f5e709a3c7dca2337e9e26e1d' }
  pw:channel:event   }
  pw:channel:event } +0ms
  pw:protocol ◀ RECV {"method":"Runtime.executionContextCreated","params":{"context":{"id":2,"origin":"","name":"__playwright_utility_world__","uniqueId":"8661107130363845658.5094228730823388992","auxData":{"isDefault":false,"type":"isolated","frameId":"C52202D4B739564FFB365DA92230C91E"}}},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +1ms
  pw:protocol ◀ RECV {"id":20,"result":{"executionContextId":2},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +0ms
  pw:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","name":"networkAlmostIdle","timestamp":36708.675533},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +932ms
  pw:protocol ◀ RECV {"method":"Page.lifecycleEvent","params":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"197E41D002EB53228B64B64AB822DA51","name":"networkIdle","timestamp":36708.675533},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +1ms
  pw:channel:response {
  pw:channel:response   id: 4,
  pw:channel:response   error: {
  pw:channel:response     error: {
  pw:channel:response       message: 'Timeout 30000ms exceeded.\n' +
  pw:channel:response         '=========================== logs ===========================\n' +
  pw:channel:response         'navigating to "https://www.belfius.be/", waiting until "load"\n' +
  pw:channel:response         '============================================================',
  pw:channel:response       stack: 'TimeoutError: Timeout 30000ms exceeded.\n' +
  pw:channel:response         '=========================== logs ===========================\n' +
  pw:channel:response         'navigating to "https://www.belfius.be/", waiting until "load"\n' +
  pw:channel:response         '============================================================\n' +
  pw:channel:response         '    at ProgressController.run (/Users/christophelombart/Dev/script-comparateur/node_modules/playwright-core/lib/server/progress.js:96:26)\n' +
  pw:channel:response         '    at Frame.goto (/Users/christophelombart/Dev/script-comparateur/node_modules/playwright-core/lib/server/frames.js:620:23)\n' +
  pw:channel:response         '    at FrameDispatcher.goto (/Users/christophelombart/Dev/script-comparateur/node_modules/playwright-core/lib/dispatchers/frameDispatcher.js:80:77)\n' +
  pw:channel:response         '    at DispatcherConnection.dispatch (/Users/christophelombart/Dev/script-comparateur/node_modules/playwright-core/lib/dispatchers/dispatcher.js:352:46)',
  pw:channel:response       name: 'TimeoutError'
  pw:channel:response     }
  pw:channel:response   }
  pw:channel:response } +30s
  pw:api <= page.goto failed +30s
page.goto: Timeout 30000ms exceeded.
=========================== logs ===========================
navigating to "https://www.belfius.be/", waiting until "load"
============================================================
    at /Users/christophelombart/Dev/script-comparateur/banks/test.js:8:16 {
  name: 'TimeoutError'
}
  pw:api => browser.close started +4ms
  pw:channel:command {
  pw:channel:command   id: 5,
  pw:channel:command   guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab',
  pw:channel:command   method: 'close',
  pw:channel:command   params: undefined
  pw:channel:command } +30s
  pw:browser [pid=30982] <gracefully close start> +30s
  pw:protocol ◀ RECV {"id":-9999,"result":{}} +29s
  pw:protocol ◀ RECV {"method":"Inspector.detached","params":{"reason":"Render process gone."},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +3ms
  pw:protocol ◀ RECV {"id":21,"result":{"frameId":"C52202D4B739564FFB365DA92230C91E","loaderId":"2DF7B7877093D0570894EE7BD22C6431"},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +9ms
  pw:protocol ◀ RECV {"method":"Network.loadingFailed","params":{"requestId":"2DF7B7877093D0570894EE7BD22C6431","timestamp":36738.740754,"type":"Document","errorText":"net::ERR_ABORTED","canceled":true},"sessionId":"B948B16D59A9CD517144E2F07B179082"} +1ms
  pw:channel:event {
  pw:channel:event   guid: 'frame@6bb1251e6f8360f6eb719f8a7a111d1d',
  pw:channel:event   method: 'navigated',
  pw:channel:event   params: {
  pw:channel:event     url: 'about:blank',
  pw:channel:event     name: '',
  pw:channel:event     error: 'net::ERR_ABORTED; maybe frame was detached?',
  pw:channel:event     newDocument: { request: [Object] }
  pw:channel:event   }
  pw:channel:event } +30s
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: 'requestFailed',
  pw:channel:event   params: {
  pw:channel:event     request: { guid: 'request@68358544e4bd980870041006768ac73d' },
  pw:channel:event     failureText: 'net::ERR_ABORTED',
  pw:channel:event     responseEndTiming: -1,
  pw:channel:event     page: { guid: 'page@7700523f5e709a3c7dca2337e9e26e1d' }
  pw:channel:event   }
  pw:channel:event } +1ms
  pw:protocol ◀ RECV {"method":"Target.detachedFromTarget","params":{"sessionId":"B948B16D59A9CD517144E2F07B179082","targetId":"C52202D4B739564FFB365DA92230C91E"}} +1ms
  pw:channel:event {
  pw:channel:event   guid: 'page@7700523f5e709a3c7dca2337e9e26e1d',
  pw:channel:event   method: 'close',
  pw:channel:event   params: undefined
  pw:channel:event } +1ms
  pw:channel:event {
  pw:channel:event   guid: 'page@7700523f5e709a3c7dca2337e9e26e1d',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: 'Tracing@cd29d7b91a894ba43315afe666d6615e',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +16ms
  pw:channel:event {
  pw:channel:event   guid: 'fetchRequest@4d9eed5ee01a0168888fc90c71d8829d',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: 'close',
  pw:channel:event   params: undefined
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@102a6e6334eca2f7608830a922204f74',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab',
  pw:channel:event   method: 'close',
  pw:channel:event   params: undefined
  pw:channel:event } +0ms
  pw:channel:event {
  pw:channel:event   guid: 'browser@c086f7c8be1485bf593945e5fdb2d7ab',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +1ms
  pw:browser [pid=30982] <process did exit: exitCode=0, signal=null> +130ms
  pw:browser [pid=30982] starting temporary directories cleanup +1ms
  pw:browser [pid=30982] finished temporary directories cleanup +17ms
  pw:browser [pid=30982] <gracefully close end> +0ms
  pw:channel:response { id: 5 } +157ms
  pw:api <= browser.close succeeded +149ms
rwoll commented 2 years ago

Thanks! After that initial Network.requestWillBeSent it looks like the browser isn't getting data back from the site.

I can't reproduce; can you share some other sites you aren't able to test in hopes of me repro'ing? Please also include a cloneable repo so we can see the full setup of your repro.

christophebe commented 2 years ago

I cleared the browsing data in Chromium and now it works fine with the headless=false I am going to continue my tests and we will see :-)

Thanks