Beispiel #1
0
 def wait_until_visible(self, timeout=None) -> None:
     assert self.robopom_plugin is not None, \
         f"wait_until_visible: self.robopom_plugin should not be None"
     SeleniumLibrary.WaitingKeywords(
         self.selenium_library).wait_until_element_is_visible(
             f"{constants.PATH_PREFIX}:{self.absolute_path}",
             timeout=timeout,
             # error=f"Element {self} not visible after {timeout}",
         )
Beispiel #2
0
 def wait_until_loaded(self, timeout=None) -> None:
     prev_frame = self.robopom_plugin.get_current_frame()
     SeleniumLibrary.FrameKeywords(self.selenium_library).select_frame(
         self.path_locator)
     super().wait_until_loaded(timeout=timeout)
     self.robopom_plugin.driver.switch_to.frame(prev_frame)
Beispiel #3
0
def stop_selenium_server():
    SeleniumLibrary.shut_down_selenium_server()
Beispiel #4
0
def start_selenium_server():
    logfile = open(os.path.join(ROOT, 'selenium_log.txt'), 'w')
    SeleniumLibrary.start_selenium_server(logfile)
Beispiel #5
0
def stop_selenium_server():
    SeleniumLibrary.shut_down_selenium_server()
Beispiel #6
0
def start_selenium_server():
    logfile = open(os.path.join(ROOT, 'selenium_log.txt'), 'w')
    SeleniumLibrary.start_selenium_server(logfile)
                default_value = f"'{default_value}'"
            elif isinstance(default_value, timedelta):
                default_value = f"timedelta(seconds={default_value.total_seconds()})"
            arg_str = f"{arg_str} = {default_value}"
        else:
            arg_str = argument
            arg_type_str = get_type_sting_from_argument(arg_str, keyword_types)
            if arg_type_str:
                arg_str = arg_str + f": {arg_type_str}"
        arguments_list.append(arg_str)
    arguments_string = (f", {', '.join(arguments_list)}"
                        if len(arguments_list) > 0 else "")
    return f"    def {method_name}(self{arguments_string}): ...\n"


SL: Any = SeleniumLibrary.SeleniumLibrary()
FUNCTION_LIST = get_function_list_from_keywords(SL.get_keyword_names())

pyi_boilerplate = """\
from datetime import timedelta
from typing import Any, Optional, Union

import selenium
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.remote.webelement import WebElement

class SeleniumLibrary:
"""
pyi_boilerplate_append = """
    def add_library_components(self, library_components): ...
    def get_keyword_names(self): ...
 async def get(self, *args, **kwargs):
     keyword = [
         keyword.title().translate(str.maketrans('_', ' '))
         for keyword in SeleniumLibrary().get_keyword_names()
     ]
     return self.json(JsonResponse(code=1, data={'keyword': keyword}))