rod icon indicating copy to clipboard operation
rod copied to clipboard

Problems in latest version

Open luabagg opened this issue 4 months ago • 2 comments

Rod Version: v0.116.2

The code to demonstrate your question

Works as expected

func TestRod(t *testing.T) {
	browser := rod.New().MustConnect()
	defer browser.MustClose()

	tests := []struct {
		name  string
		input *rod.Page
	}{
		{
			name:  "1",
			input: browser.MustPage("https://www.example.com"),
		},
	}
	for _, tc := range tests {
		t.Run(tc.name, func(t *testing.T) {
			tc.input.WaitLoad()
			tc.input.Screenshot(true, &proto.PageCaptureScreenshot{
				Format:                "png",
				Quality:               new(int),
				FromSurface:           false,
				CaptureBeyondViewport: false,
				OptimizeForSpeed:      false,
			})
		})
	}
}

Fails

func TestRod(t *testing.T) {
	browser := rod.New().MustConnect()
	defer browser.MustClose()

	tests := []struct {
		name  string
		input *rod.Page
	}{
		{
			name:  "1",
			input: browser.MustPage("https://www.example.com"),
		},
		{
			name:  "2",
			input: browser.MustPage("https://www.example.com"),
		},
		{
			name:  "3",
			input: browser.MustPage(),
		},
	}
	for _, tc := range tests {
		t.Run(tc.name, func(t *testing.T) {
			tc.input.WaitLoad()
			tc.input.Screenshot(true, &proto.PageCaptureScreenshot{
				Format:                "png",
				Quality:               new(int),
				FromSurface:           false,
				CaptureBeyondViewport: false,
				OptimizeForSpeed:      false,
			})
		})
	}
}

What you got

Second case

image

What you expect to see

 ok  	github.com/go-rod/rod

What have you tried to solve the question

Didn't look the problem yet. I'm opening the issue to inform you about the problem. Tested in 0.112.x, 0.115.x, 0.116.0 - all works as expected.

luabagg avatar Oct 13 '24 16:10 luabagg