Exemplo n.º 1
0
 def apply(self, filter_name, value):
     self.select(filter_name)
     if len(self.browser.elements(parent=self, locator=self.VALUE_INPUT)):
         _input = TextInput(parent=self, locator=self.VALUE_INPUT)
         _input.fill(value + '\n')
     elif len(
             self.browser.elements(parent=self,
                                   locator=self.VALUE_DROPDOWN)):
         _dropdown = DropDown(parent=self, locator=self.VALUE_DROPDOWN)
         _dropdown.select(value)
     else:
         raise NoSuchElementException(
             'There is no "Input" or "Dropdown" component found!')
     # wait to Spinner disappear
     wait_to_spinner_disappear(self.browser)
Exemplo n.º 2
0
class Login(Widget):
    ROOT = '//*[@id="kiali-login"]'
    USERNAME = '******'
    PASSWORD = '******'
    SUBMIT = './/button[@type="submit"]'

    def __init__(self, parent, logger=None):
        Widget.__init__(self, parent, logger=logger)
        self.username = TextInput(parent=self, locator=self.USERNAME)
        self.password = TextInput(parent=self, locator=self.PASSWORD)
        self.submit = Button(parent=self.parent,
                             locator=self.SUBMIT,
                             logger=logger)

    def login(self, username, password):
        self.username.fill(username)
        self.password.fill(password)
        self.browser.click(self.submit)