Ejemplo n.º 1
0
    def execute(self, url):
        self.browser.get(url)
        self.password = rand_text(10, 20)

        input_elements = self.browser.find_elements(By.TAG_NAME, "input")
        select_elements = self.browser.find_elements(By.TAG_NAME, "select")
        textarea_elements = self.browser.find_elements(By.TAG_NAME, "textarea")

        elements = input_elements + select_elements + textarea_elements
        self.order(elements)

        for el in elements:
            tag_name = el.tag_name.lower()
            if tag_name == "input":
                getattr(self, f"handle_input_type_{el.get_attribute('type')}",
                        lambda _: None)(el)
            else:
                getattr(self, f"handle_{tag_name}", lambda _: None)(el)

        self.browser.find_element_by_css_selector(
            "button[type=submit]").click()
        time.sleep(0.5)
Ejemplo n.º 2
0
 def handle_textarea(self, el):
     el.click()
     el.send_keys(rand_text(70, 110))
Ejemplo n.º 3
0
 def handle_textarea(self, el):
     self.click_element(el)
     el.send_keys(rand_text(70, 110))
Ejemplo n.º 4
0
 def handle_input_type_text(self, el):
     el.click()
     el.send_keys(rand_text(10, 20))
Ejemplo n.º 5
0
 def handle_input_type_text(self, el):
     self.click_element(el)
     el.send_keys(rand_text(10, 20))