Window: A browser window

Description Usage Arguments Details

Description

A browser window

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
w <- s$getWindow()
wlist <- s$getAllWindows()

w$close()
w$isActive()
w$switchTo()
w$maximize()
w$getSize()
w$setSize(width, height)
w$getPosition()
w$setPosition(x, y)

Arguments

s

A Session object.

w

A Window object.

wlist

A list of Window objects.

width

Integer scalar, requested width of the window.

height

Integer scalar, requested height of the window.

x

Integer scalar, requested horizontal window position.

y

Integer scalar, requested vertical window position.

Details

The getWindow method of a Session object returns the current browser window as a Window object. The getAllWindows method returns a list of window objects, all browser windows.

w$close() closes the window.

w$isActive() returns TRUE if the window is active, FALSE otherwise.

w$switchTo makes the window active.

w$maximize maximizes the window. Currently it sets it to a fixed size.

w$getSize returns the size of the window, in a list with elementh width and height, both integers.

w$setSize sets the size of the window.

w$getPosition returns the position of the window on the screen. Phantom.js being headless, it always returns list(x = 0, y = 0), and it is included to have a complete impelementation of the WebDriver standard.

w$setPosition(x, y) sets the position of the window on the screen. Phantom.js being headless, it has no effect, and it is included to have a complete implementation of the WebDriver standard.


rstudio/webdriver documentation built on Jan. 26, 2022, 8:12 a.m.