octaltree / playwright-rust

Playwright port to Rust
297 stars 30 forks source link

Browser has black screen when not headless #21

Open randall-coding opened 2 years ago

randall-coding commented 2 years ago

I'm turning headless mode off while I debug, but all that is rendered is a black screen. When I run eval I see that the dom is there and can be interacted with for the website, however I can't see anything on the screen.

I've tried looking through the Browser Launcher options but I don't see anything that I think would help. Does anyone have a solution to this?

let playwright = Playwright::initialize().await.unwrap();
playwright.prepare().unwrap();

let chromium = playwright.chromium();
let browser = chromium.launcher().headless(false).launch().await.unwrap();
let context = browser.context_builder().build().await.unwrap();
let page = context.new_page().await.unwrap();
page.goto_builder("https://www.duckduckgo.com").goto().await.unwrap();

ksnip_20220114-120535

About my machine: Running Ubuntu 21.04

randall-coding commented 2 years ago

I tried firefox also. It does not have the black screen error, but has a different type. It errors out and crashes if I unwrap on the goto.

'called Result::unwrap() on an Err value: Serde(Error("invalid type: map, expected a string", line: 0, column: 0))', src/bin/webview.rs:47:69

This is line 47 allegedly causing the error. page.goto_builder("https://www.duckduckgo.com").goto().await.unwrap();

randall-coding commented 2 years ago

PARTIAL SOLUTION:

I realized my playwright was outdated because my rust compiler wasn't the latest. I upgraded to the latest version of rustc nightly, and this fixed the issue with firefox but not the black screen issue with chromium.

Upgraded playwright from 0.9 to 0.19. Using rust nightly 1.60