19 from selenium.common.exceptions
import NoSuchWindowException
29 LibraryComponent.__init__(self, ctx)
106 timeout = epoch
if is_falsy(timeout)
else timestr_to_secs(timeout) + epoch
109 except NoSuchWindowException:
132 ids = [info.id
for info
in self.
_window_manager_window_manager.get_window_infos()]
138 names = [info.name
for info
in self.
_window_manager_window_manager.get_window_infos()]
144 titles = [info.title
for info
in self.
_window_manager_window_manager.get_window_infos()]
150 urls = [info.url
for info
in self.
_window_manager_window_manager.get_window_infos()]
174 inner_width = int(self.
driverdriverdriver.execute_script(
"return window.innerWidth;"))
175 inner_height = int(self.
driverdriverdriver.execute_script(
"return window.innerHeight;"))
176 return inner_width, inner_height
178 return size[
'width'], size[
'height']
204 width, height = int(width), int(height)
208 inner_width = int(self.
driverdriverdriver.execute_script(
"return window.innerWidth;"))
209 inner_height = int(self.
driverdriverdriver.execute_script(
"return window.innerHeight;"))
210 self.
infoinfo(
'window.innerWidth is %s and window.innerHeight is %s' % (inner_width, inner_height))
211 width_offset = width - inner_width
212 height_offset = height - inner_height
213 window_width = width + width_offset
214 window_height = height + height_offset
215 self.
infoinfo(
'Setting window size to %s %s' % (window_width, window_height))
217 result_width = int(self.
driverdriverdriver.execute_script(
"return window.innerWidth;"))
218 result_height = int(self.
driverdriverdriver.execute_script(
"return window.innerHeight;"))
219 if result_width != width
or result_height != height:
220 raise AssertionError(
"Keyword failed setting correct window size.")
233 return position[
'x'], position[
'y']
254 'Altogether %s %s%s.'
255 % (len(items), what, plural_or_not(items))
257 for index, item
in enumerate(items):
258 msg.append(
'%s: %s' % (index + 1, item))
259 self.
infoinfo(
'\n'.join(msg))
def info(self, msg, html=False)
def select_window(self, locator='MAIN', timeout=None)
Selects browser window matching locator.
def set_window_size(self, width, height, inner=False)
Sets current windows size to given width and height.
def close_window(self)
Closes currently opened pop-up window.
def maximize_browser_window(self)
Maximizes current browser window.
def get_window_names(self)
Returns and logs names of all known browser windows.
def get_window_handles(self)
Return all current window handles as a list.
def get_window_identifiers(self)
Returns and logs id attributes of all known browser windows.
def __init__(self, ctx)
Base class exposing attributes from the common context.
def get_window_position(self)
Returns current window position.
def get_window_titles(self)
Returns and logs titles of all known browser windows.
def set_window_position(self, x, y)
Sets window position using x and y coordinates.
def get_window_size(self, inner=False)
Returns current window width and height as integers.
def _log_list(self, items, what='item')
def get_locations(self)
Returns and logs URLs of all known browser windows.