chromiumoxide icon indicating copy to clipboard operation
chromiumoxide copied to clipboard

html page does not expand to window extents

Open davehorner opened this issue 2 years ago • 4 comments

Below is the code I am using to test oxide.

    let baseurl = "http://www.google.com".to_owned();
    let (browser, mut handler) =
      Browser::launch(BrowserConfig::builder().with_head().build()?).await?;
    let handle = tokio::task::spawn(async move {
        loop {
            let _ = handler.next().await.unwrap();
        }
    });

    let _p = browser.new_page(baseurl.clone()).await?;
    handle.await?;
    Ok(())

The page comes up and the viewport/webpage is not expanding to the window extents. Is there something that would cause this resize issue?

davehorner avatar Sep 26 '22 13:09 davehorner

I also would like to know how to do this properly. My current solution is to set both window_size and viewport.

         BrowserConfig::builder()
            .window_size(1600, 1000)
            .viewport(Viewport {
                width: 1600,
                height: 1000,
                ..Viewport::default()
            })
            .with_head()
            .build()?

edave64 avatar Oct 18 '22 19:10 edave64

I've tried setting a height and width and creating a viewport too. Sometimes the viewport will size correctly.

   Browser::launch(BrowserConfig::builder()
      .viewport(Viewport { width: 1190, height: 800, device_scale_factor: None, emulating_mobile: false, is_landscape: true, has_touch: false })
      .window_size(1190,800)

I don't think setting the window_size and viewport are the fix. I couldn't come up with any other ideas on triangulating what the ultimate cause. Chrome does not exhibit the same behavior when run normally.

It's sizing this morning on my machine properly. I was going to close the ticket but I still experience it intermittently. If someone else is experiencing the sizing issues too, that helps.

davehorner avatar Oct 19 '22 11:10 davehorner

This seems to be a duplicate of https://github.com/mattsse/chromiumoxide/issues/100

d4h0 avatar Mar 16 '23 13:03 d4h0

This is not nodejs or puppeteer, I don't understand the resolution. I stopped using chromiumoxide because I couldn't get this figured out.

davehorner avatar Mar 16 '23 13:03 davehorner

I got it working with this code

let (mut browser, mut handler) =
    Browser::launch(
        BrowserConfig::builder()
            .window_size(1920, 1080)
            .viewport(None)
            .with_head()
            .build()?
        ).await?;

I don't get why this is still an open issue

F8RZD avatar May 01 '24 20:05 F8RZD