diff --git a/browser.go b/browser.go index 8d926a2..4f8902b 100644 --- a/browser.go +++ b/browser.go @@ -240,3 +240,17 @@ 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) GetWindowSize()(width,height int, err error) { + size,err := b.session.GetCurrentWindowHandle().GetSize() + if err != nil { + return + } + return size.Width,size.Height, nil +} diff --git a/example/example_test.go b/example/example_test.go index 9bacf17..b362758 100644 --- a/example/example_test.go +++ b/example/example_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/atotto/webtester" - "github.com/atotto/webtester/chrome" + "github.com/groove-x/webtester" + "github.com/groove-x/webtester/chrome" ) func TestMain(m *testing.M) { @@ -60,6 +60,7 @@ func TestPlayground(t *testing.T) { defer ts.TearDown() b := ts.OpenBrowser() + b.SetWindowSize(1600,1200) b.SetPageLoadTimeout(2 * time.Second) b.VisitTo("https://play.golang.org/")