public class Window
extends java.lang.Object
Browser.window()
.
This class is used to create, close and refresh browser windows and to switch between them. In addition, it supports the detection of popups and alerts.
Constructor and Description |
---|
Window(Browser browser)
Constructs new BrowserWindow instance to interact with browser windows.
|
Modifier and Type | Method and Description |
---|---|
void |
checkForAlerts() |
void |
closeAllPopups()
Closes all popup windows (all windows except the initial main window).
|
void |
closePopup(Popup popup)
Closes specified popup.
|
void |
closeWindow(java.lang.String windowHandle)
Closes window with specified handle.
|
void |
detectPopups()
Detects popups, not fully supported yet.
|
org.openqa.selenium.Alert |
getAlert()
Detects alerts, not fully supported yet.
|
java.lang.String |
getContentTypeOfURL(java.net.URL url)
Gets content type for specified
URL . |
java.lang.String |
getCurrentContentType()
Gets content type of current page.
|
java.lang.String |
getCurrentWindowName()
Gets current name of active window.
|
Popups |
getPopups()
Gets current popups.
|
void |
refresh()
Refreshs the current page.
|
void |
switchToLastOpenedPopup()
Switches to the last opened popup.
|
void |
switchToMainContent()
Switches to main content in the current window.
|
void |
switchToMainWindow()
Switches to main window.
|
void |
switchToPopup(Popup popup)
Switches to the specified popup.
|
void |
switchToWindow(java.lang.String windowName)
Switches to window with specified name or handle.
|
public Window(Browser browser)
browser
- Browser
instance to work withpublic void detectPopups()
public void checkForAlerts()
public org.openqa.selenium.Alert getAlert()
Alert
object if an alert was detected, or null if notpublic void refresh()
HtmlElement
instances may lose their validity.public void switchToMainContent()
public void switchToMainWindow()
public void switchToLastOpenedPopup()
public void switchToPopup(Popup popup)
popup
- public void switchToWindow(java.lang.String windowName)
windowName
- public void closeAllPopups()
public void closePopup(Popup popup)
popup
- public void closeWindow(java.lang.String windowHandle)
windowHandle
- public java.lang.String getCurrentWindowName()
public Popups getPopups()
public java.lang.String getCurrentContentType()
public java.lang.String getContentTypeOfURL(java.net.URL url)
URL
.url
-