Skip to content

Commit

Permalink
#101: refactored aliases for some methods
Browse files Browse the repository at this point in the history
  • Loading branch information
yashaka committed Mar 1, 2017
1 parent 1d19ac3 commit cc792f1
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions selene/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ def quit_driver():
driver().quit()


# todo: do we need a browser.quit() alias for browser.quit_driver (do we actually need browser.quit_driver()?)
# the problem is with that it is standard method quit() in python,
# and if user will import directly quit from selene.browser there might be some conflicts...
def quit():
quit_driver()

Expand All @@ -26,8 +23,6 @@ def close():
driver().close()


# todo: do we need a browser.close_current_window() alias for browser.close()?

def set_driver(webdriver):
# type: (WebDriver) -> None
if selene.factory.is_another_driver(webdriver):
Expand Down Expand Up @@ -60,20 +55,24 @@ def visit(absolute_or_relative_url):
driver().get(base_url + absolute_or_relative_url)


def s(css_selector_or_by):
def element(css_selector_or_by):
return SeleneElement.by_css_or_by(css_selector_or_by, selene.driver._shared_driver)


def element(css_selector_or_by):
return s(css_selector_or_by)
def s(css_selector_or_by):
return element(css_selector_or_by)


def ss(css_selector_or_by):
def elements(css_selector_or_by):
return SeleneCollection.by_css_or_by(css_selector_or_by, selene.driver._shared_driver)


def elements(css_selector_or_by):
return ss(css_selector_or_by)
def all(css_selector_or_by):
return elements(css_selector_or_by)


def ss(css_selector_or_by):
return elements(css_selector_or_by)

_latest_screenshot = NoneObject("selene.tools._latest_screenshot")

Expand Down

0 comments on commit cc792f1

Please sign in to comment.