コード例 #1
0
 def setUp(self) -> None:
     self.login_action = login_action(driver())
コード例 #2
0
ファイル: home_page.py プロジェクト: moonlight-a/AutoWeb
import time
from public.base import driver
from public.operation_public_page import operation_page_function


class home_action(operation_page_function):

    #获取首页图片
    def compare_image(self):
        time.sleep(3)
        self.get_image('首页')


if __name__ == '__main__':
    hh = home_action(driver())

    hh.compare_image()
コード例 #3
0
        self.password = kwargs.get('password')
        user_mess = self.find_element_by_xpath(username_element)
        pass_mess = self.find_element_by_xpath(password_element)
        user_mess.send_keys(self.username)
        pass_mess.send_keys(self.password)
        self.find_element_class(logon_button_element).click()
        time.sleep(1)

    #检查登录状态

    def check_login_status(self):
        operation_url = self.get_currernt_url()
        #判断usernme或者password是否有值,决定调用alert还是tips_error
        if self.curr_url != operation_url:
            return True
        elif self.username == '' and self.password == '':
            return self.get_tips_error()
        elif self.username == '' or self.password == '':
            return self.get_tips_error()
        else:
            return self.get_alter_text()


if __name__ == '__main__':

    ll = login_action(driver())
    # 'username'='lijie7','password'='123456789'
    www = ll.login_on(username='******', password='******')
    wwwwww = ll.check_login_status()
    print(wwwwww)
コード例 #4
0
    def operation_second_sure_button(self, index):
        #index,根据当前元素实际的下标进行传入
        value = self.find_elements_by_xpath(SECOND_ALTER_SURE_ELEMENNT)
        value[index].click()
        return None

    #操作二次弹窗取消按钮
    def operation_second_cancle_button(self, index):
        # index,根据当前元素实际的下标进行传入
        value = self.find_elements_by_xpath(SECOND_ALTER_CANCEL_ELEMENT)
        value[index].click()
        return None

    # 获取查询结果页面返回的数量值
    def get_query_data_total(self):
        total = self.find_element_class(Query_result_count_element)
        total_value = total.text
        str_list = total_value.split(' ')
        int_value = str_list[1]
        return int_value

    #操作页面导入按钮
    def operation_import_button(self, file_path):
        self.find_element_by_xpath(IMPORT_BUTTON).send_keys(file_path)
        return None


if __name__ == '__main__':
    operation_page = operation_page_function(driver())

    operation_page.enter_moudle_name(1)
コード例 #5
0
        return None

    @allure.step('删除组织数据')
    def operation_delete_organization(self):
        self.operation_hide_data().get('删除').click()
        #删除操作会进行二次确认需调用操作二次弹窗方法
        self.operation_second_cancle_button(5)

    def main(self):
        self.enter_organization()
        time.sleep(3)
        self.operation_hide_data()
        self.operation_delete_organization()

        # self.click_senior_button()
        # self.input_search_value(1,search_one='1234',search_two='987654',search_three='15155972770')


if __name__ == '__main__':

    ll = page_one(driver())
    # 'username'='lijie7','password'='123456789'

    ll.main()

    # time.sleep(3)
    # ll.delete_page_screen()
    # aaa = ll.operation_delete()
    # print(aaa)
    # connect_sql.close()
コード例 #6
0
 def test_01(self):
     search_page(driver()).screen_page()
コード例 #7
0
#截图操作

    def get_image(self, pagename):
        path = os.path.dirname(os.path.dirname(__file__))
        current_time = datetime.datetime.now()
        time_str = datetime.datetime.strftime(current_time,
                                              '%Y-%m-%d_%H-%M-%S')
        image_file = path + '//Picture//' + pagename + '_' + time_str + '.png'

        try:

            self.driver.get_screenshot_as_file(image_file)

        except BaseException as e:
            print(e)


#操作需要鼠标悬浮显示元素值

    def mouse_action(self, aa):

        ActionChains(self.driver).move_to_element(aa).click(aa).perform()
        # time.sleep(2)
        # self.find_element_by_link_text(operation_text).click()
        return None

if __name__ == '__main__':

    e = Element(base.driver())
    w = e.tree_button_element()
    print(w)
コード例 #8
0
ファイル: test_login.py プロジェクト: moonlight-a/AutoWeb
    def test_01(self):
        aa = login_action(driver())
        aa.login_on(username='', password='******')
        res =aa.check_login_status()

        assert "请输入登录ID" == res[0]