Esempio n. 1
0
 def js_click(self, element):
     # DriverUtil.get_driver().find_element(element).click()
     #
     try:
         print("{}JS点击按钮成功".format(element))
         Driver.get_driver().execute_script("arguments[0].click();",
                                            element)
     # webdriver.ActionChains(DriverUtil.get_driver()).click(element).perform()
     except Exception as e:
         print(e, "{}JS点击按钮失败".format(element))
Esempio n. 2
0
    def date_input(self, style, ele, index):
        """

        :param style: CSS元素类型
        :param ele: CSS元素
        :param index: 下标
        :return:
        """
        self.js = 'document.getElementsBy{}("{}")[{}].removeAttribute("readonly")'.format(
            style, ele, index)
        Driver.get_driver().execute_script(self.js)
Esempio n. 3
0
 def out_text_iframe(self):
     # 切出
     Driver.get_driver().switch_to.default_content()
Esempio n. 4
0
 def enter_text_iframe(self, iframeid):
     # 切入
     Driver.get_driver().switch_to.frame(iframeid)
Esempio n. 5
0
 def js(self, ele):
     Driver.get_driver().execute_script(ele)
Esempio n. 6
0
 def scroll(self, ele):
     Driver.get_driver().execute_script("arguments[0].scrollIntoView();",
                                        ele)