Ejemplo n.º 1
0
class Google:
    def __init__(self):
        # Create a WebDriver instance for chrome.
        self.__web_driver = WebDriver(WebDriverType.CHROME)

        # The google apps grid button is in the top-right.
        # This button is always in the page, so it is StaticElement.
        self.__google_apps_grid_button = StaticElement(self.__web_driver,
                                                       "class=gb_b")

        # After clicked the google apps grid button, the google apps list will be shown.
        # This list is always in the page, although it is invisible, it is StaticElement.
        self.__google_apps_list = StaticElement(self.__web_driver,
                                                "class=gb_ha")

        # Currently the StaticElement does not refer to WebElement in Browser,
        # so open url here is fine.
        self.__web_driver.open("https://www.google.com")

    def click_google_apps_grid_button(self):
        # It is StaticElement, easyium will wait it to be visible automatically.
        self.__google_apps_grid_button.click()

        # Let's return the GoogleAppsList object.
        return GoogleAppsList(self.__google_apps_list)

    def quit(self):
        self.__web_driver.quit()
Ejemplo n.º 2
0
class Google:
    def __init__(self):
        # Create a WebDriver instance for chrome.
        self.__web_driver = WebDriver(WebDriverType.CHROME)

        # The google apps grid button is in the top-right.
        # This button is always in the page, so it is StaticElement.
        self.__google_apps_grid_button = StaticElement(self.__web_driver, "class=gb_b")

        # After clicked the google apps grid button, the google apps list will be shown.
        # This list is always in the page, although it is invisible, it is StaticElement.
        self.__google_apps_list = StaticElement(self.__web_driver, "class=gb_ha")

        # Currently the StaticElement does not refer to WebElement in Browser,
        # so open url here is fine.
        self.__web_driver.open("https://www.google.com")

    def click_google_apps_grid_button(self):
        # It is StaticElement, easyium will wait it to be visible automatically.
        self.__google_apps_grid_button.click()

        # Let's return the GoogleAppsList object.
        return GoogleAppsList(self.__google_apps_list)

    def quit(self):
        self.__web_driver.quit()
Ejemplo n.º 3
0
    def __init__(self):
        # Create a WebDriver instance for chrome.
        self._web_driver = Chrome()

        # The google apps grid button is in the top-right.
        # This button is always in the page, so it is StaticElement.
        self._google_apps_grid_button = StaticElement(self._web_driver,
                                                      "class=gb_b")

        # After clicked the google apps grid button, the google apps list will be shown.
        # This list is always in the page, although it is invisible, it is StaticElement.
        self._google_apps_list = StaticElement(self._web_driver, "class=gb_ha")

        # Currently the StaticElement does not refer to WebElement in Browser,
        # so open url here is fine.
        self._web_driver.get("https://www.google.com")
Ejemplo n.º 4
0
class GoogleApp:
    def __init__(self, element):
        self.__element = element

        # This locator is relative to parent.
        self.__name = StaticElement(self.__element, "class=gb_4")

    def get_name(self):
        # get_text() doesn't work here, so use javascript
        # return self.name.get_text()
        return self.__name.get_web_driver().execute_script('return arguments[0].innerText', self.__name)
Ejemplo n.º 5
0
class GoogleApp:
    def __init__(self, element):
        self.__element = element

        # This locator is relative to parent.
        self.__name = StaticElement(self.__element, "class=gb_4")

    def get_name(self):
        # get_text() doesn't work here, so use javascript
        # return self.name.get_text()
        return self.__name.get_web_driver().execute_script(
            'return arguments[0].innerText', self.__name)
Ejemplo n.º 6
0
    def __init__(self):
        # Create a WebDriver instance for chrome.
        self.__web_driver = WebDriver(WebDriverType.CHROME)

        # The google apps grid button is in the top-right.
        # This button is always in the page, so it is StaticElement.
        self.__google_apps_grid_button = StaticElement(self.__web_driver, "class=gb_b")

        # After clicked the google apps grid button, the google apps list will be shown.
        # This list is always in the page, although it is invisible, it is StaticElement.
        self.__google_apps_list = StaticElement(self.__web_driver, "class=gb_ha")

        # Currently the StaticElement does not refer to WebElement in Browser,
        # so open url here is fine.
        self.__web_driver.open("https://www.google.com")
Ejemplo n.º 7
0
    def __init__(self, element):
        self.__element = element

        # This locator is relative to parent.
        self.__name = StaticElement(self.__element, "class=gb_4")
Ejemplo n.º 8
0
    def __init__(self, element):
        self.__element = element

        # This locator is relative to parent.
        self.__name = StaticElement(self.__element, "class=gb_4")