Skip to content

Commit

Permalink
Merge c9fd36e into 5888b32
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Falešník committed Mar 13, 2017
2 parents 5888b32 + c9fd36e commit eba5163
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 156 deletions.
8 changes: 8 additions & 0 deletions src/widgetastic/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import time

from cached_property import cached_property
from collections import namedtuple
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
Expand All @@ -32,6 +33,8 @@ def is_valid(cls, strategy):

By.is_valid = classmethod(is_valid)

Size = namedtuple('Size', ['width', 'height'])


class DefaultPlugin(object):
ENSURE_PAGE_SAFE = '''\
Expand Down Expand Up @@ -440,6 +443,11 @@ def set_attribute(self, attr, value, *args, **kwargs):
"arguments[0].setAttribute(arguments[1], arguments[2]);",
self.element(*args, **kwargs), attr, value)

def size_of(self, *args, **kwargs):
"""Returns element's size as a tuple of width/height."""
size = self.element(*args, **kwargs).size
return Size(size['width'], size['height'])

def clear(self, locator, *args, **kwargs):
"""Clears a text input with given locator."""
self.logger.debug('clear: %r', locator)
Expand Down

0 comments on commit eba5163

Please sign in to comment.