From 16cc1e9414c8512b2ae1748a9137b9601b4bc0c4 Mon Sep 17 00:00:00 2001 From: Takaaki Shirai Date: Tue, 26 May 2020 10:33:54 +0900 Subject: [PATCH] Update to Chrome 83 (#4) * Ease timeout * Update Chrome version/arch * go fmt --- browser.go | 12 +++++------- chrome/setup.go | 4 ++-- chrome/version_test.go | 6 +++--- example/example_test.go | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/browser.go b/browser.go index 4f8902b..0427fc9 100644 --- a/browser.go +++ b/browser.go @@ -241,16 +241,14 @@ func (b *Browser) ExpectTransitTo(rawurl string) *Browser { return b } - - -func (b *Browser) SetWindowSize(width,height int) { - b.session.GetCurrentWindowHandle().SetSize(webdriver.Size{width,height}) +func (b *Browser) SetWindowSize(width, height int) { + b.session.GetCurrentWindowHandle().SetSize(webdriver.Size{width, height}) } -func (b *Browser) GetWindowSize()(width,height int, err error) { - size,err := b.session.GetCurrentWindowHandle().GetSize() +func (b *Browser) GetWindowSize() (width, height int, err error) { + size, err := b.session.GetCurrentWindowHandle().GetSize() if err != nil { return } - return size.Width,size.Height, nil + return size.Width, size.Height, nil } diff --git a/chrome/setup.go b/chrome/setup.go index b5725be..24a9be4 100644 --- a/chrome/setup.go +++ b/chrome/setup.go @@ -47,7 +47,7 @@ func chromeVersion() (version string) { } } if err != nil { - return "74" + return "83" } return parseChromeVersion(line) } @@ -82,7 +82,7 @@ func targetArch() (target string, err error) { switch runtime.GOOS { case "darwin": - return "mac32", nil + return "mac64", nil case "linux": return "linux" + arch, nil case "windows": diff --git a/chrome/version_test.go b/chrome/version_test.go index bd354cf..1d54be6 100644 --- a/chrome/version_test.go +++ b/chrome/version_test.go @@ -7,9 +7,9 @@ func TestParseChromeVersion(t *testing.T) { line string version string }{ - {`Chromium 73.0.3683.75 Built on Ubuntu , running on Ubuntu 16.04`, "73"}, - {`Chromium 72.0.3626.122 built on Debian 9.8, running on Debian 9.4`, "72"}, - {`Google Chrome 73.0.3683.103`, "73"}, + {`Chromium 83.0.4103.39 Built on Ubuntu , running on Ubuntu 16.04`, "83"}, + {`Chromium 81.0.4044.92 built on Debian 9.8, running on Debian 9.4`, "81"}, + {`Google Chrome 83.0.4103.39`, "83"}, } for n, tt := range tests { diff --git a/example/example_test.go b/example/example_test.go index b362758..87c3caa 100644 --- a/example/example_test.go +++ b/example/example_test.go @@ -61,7 +61,7 @@ func TestPlayground(t *testing.T) { b := ts.OpenBrowser() b.SetWindowSize(1600,1200) - b.SetPageLoadTimeout(2 * time.Second) + b.SetPageLoadTimeout(4 * time.Second) b.VisitTo("https://play.golang.org/") b.WaitFor("id:code").Element().Clear().Input(code)