go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.25k stars 345 forks source link

Why doesn't it remember the window size now? #1011

Closed moxcomic closed 7 months ago

moxcomic commented 7 months ago

Rod Version: v0.114.7

I remember that in previous versions, when using the same code, if you manually dragged the window to change its size, the size would be maintained the next time you started it. But now it seems to revert to a fixed size. Is it necessary now to use MustSetWindow to maintain the window size?

Code

rod.
  New().
  ControlURL(
      launcher.New().
      Headless(false).
      Bin("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome").
      UserDataDir("./data").
      MustLaunch(),
  ).
  MustConnect().
  NoDefaultDevice().
  MustPage("")
github-actions[bot] commented 7 months ago

Please fix the format of your markdown:

6 MD003/heading-style/header-style Heading style [Expected: setext; Actual: atx]
6 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Code"]
7 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]
7 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]

generated by check-issue

ysmood commented 7 months ago

I haven't changed any related logic. I think every time you launch the browser, you will open a new tab, because different tabs can have the same url, how could you know it's the same one as the last launch?

moxcomic commented 7 months ago

I haven't changed any related logic. I think every time you launch the browser, you will open a new tab, because different tabs can have the same url, how could you know it's the same one as the last launch?

I remember that in previous versions of Chrome, the browser would remember the window size changed by dragging the mouse, but after a certain update of the Chrome browser, it no longer remembers the window size. It might be due to the Chrome update.

moxcomic commented 7 months ago

I haven't changed any related logic. I think every time you launch the browser, you will open a new tab, because different tabs can have the same url, how could you know it's the same one as the last launch?

If I don't specify UserDataDir("./data"), it can remember the window size. I don't understand the reason behind this.

ysmood commented 7 months ago

could you try without rod? I might be a chromium issue.

moxcomic commented 7 months ago

could you try without rod? I might be a chromium issue.

When I try launching with /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/path/to/data, it can remember the window size normally.

ysmood commented 7 months ago

How about use the Launcher.NewUserMode

moxcomic commented 7 months ago

How about use the Launcher.NewUserMode

It cannot record either; only when opened using the command can it normally record the window size.

ysmood commented 7 months ago

The fix will be released in the next version

ysmood commented 6 months ago

Please check v0.114.8

moxcomic commented 6 months ago

Please check v0.114.8

Thanks, the issue has been fixed after testing.