Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MinimizeWindow() #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,18 @@ func (wd *remoteWD) MaximizeWindow(name string) error {
}

func (wd *remoteWD) MinimizeWindow(name string) error {
if !wd.w3cCompatible {
if name != "" {
var err error
name, err = wd.CurrentWindowHandle()
if err != nil {
return err
}
}
url := wd.requestURL("/session/%s/window/%s/minimize", wd.id, name)
_, err := wd.execute("POST", url, nil)
return err
}
return wd.modifyWindow(name, "POST", "minimize", map[string]string{})
}

Expand Down
1 change: 1 addition & 0 deletions selenium.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ type WebDriver interface {
// MaximizeWindow maximizes a window. If the name is empty, the current
// window will be maximized.
MaximizeWindow(name string) error
MinimizeWindow(name string) error
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs a test, similar to the existing MaximizeWindow test:

t.Run("MaximizeWindow", func(t *testing.T) {

// ResizeWindow changes the dimensions of a window. If the name is empty, the
// current window will be maximized.
ResizeWindow(name string, width, height int) error
Expand Down