Example #1
0
    def start_engine(self, headless=None):
        print("driver", self.driver_path)
        chrome_options = webdriver.ChromeOptions()

        # chrome_options.add_argument("--disable-dev-shm-usage")

        if headless is None:
            headless = HEADLESS

        if isinstance(headless, str):
            headless = str2bool(headless)

        chrome_options.headless = headless
        print("Headless mode: '{0}'".format(headless), type(headless))

        try:
            self._driver = webdriver.Chrome(executable_path=self.driver_path,
                                            options=chrome_options)

        except SessionNotCreatedException as e:
            print(e.args)
            self.final_clean()
            exit(1)

        self._driver.set_window_size(1440, 900)
Example #2
0
 def wait_for_input_disappear(self):
     input_widget = self.find_it(UI.get_monako_input_widget_locator())
     hidden = str2bool(input_widget.get_attribute(constants.ARIA_HIDDEN))
     if not hidden:
         print("Press Enter again")
         self.confirm_input(input_widget)
         raise WebDriverException
Example #3
0
    def wait_for_input_with_title_disappear(self, title):
        input_frame = self.find_it(UI.get_monako_quick_input_locator())
        input_element = self.find_it(UI.get_monako_input_locator(), parent=input_frame)

        visible = str2bool(input_element.get_attribute(constants.ARIA_HAS_POPUP))

        if visible and input_element.get_attribute(constants.ELEMENT_TITLE) == title:
            raise WebDriverException
Example #4
0
    def get_input_element(self):
        input_frame = self.find_it(UI.get_monako_quick_input_locator())
        input_element = self.find_it(UI.get_monako_input_locator(), parent=input_frame)
        visible = str2bool(input_element.get_attribute(constants.ARIA_HAS_POPUP))

        if not visible:
            raise WebDriverException

        highlight(input_element)
        self.click_me(input_element)
        return input_element
Example #5
0
    def cancel_input_if_exist(self):
        try:
            input_widget = self.find_it(UI.get_monako_input_widget_locator())

        except NoSuchElementException:
            return

        hidden = str2bool(input_widget.get_attribute(constants.ARIA_HIDDEN))
        if not hidden:
            self.click_me(input_widget)
            actions = ActionChains(self.get_driver())
            actions.send_keys(Keys.ESCAPE)
            actions.perform()
            self.wait_for_input_disappear()
Example #6
0
    def start_engine(self, headless=None):
        print("driver", self.driver_path)
        safari_options = webdriver.WebKitGTKOptions()

        if headless is None:
            headless = HEADLESS

        if isinstance(headless, str):
            headless = str2bool(headless)

        safari_options.headless = headless
        print("Headless mode: '{0}'".format(headless), type(headless))

        self._driver = webdriver.Safari(executable_path=self.driver_path)
        self._driver.set_window_size(1440, 900)