zoukankan      html  css  js  c++  java
  • python+selenium自动化软件测试(第16章):基础实战(3)

    #coding:utf-8
    
    from time import sleep
    from selenium import webdriver
    
    class cloudedge_register(object):
    
    def __init__(self,mailaddr,passwd,url):
        self.mailaddr = mailaddr
        self.passwd = passwd
        self.url = url
        self.browser = webdriver.Firefox()
    
    def register(self):
        self.browser.get(self.url)
        self.browser.maximize_window()
        self.browser.implicitly_wait(10)
        self.browser.find_element_by_link_text("注册").click()
        self.browser.implicitly_wait(10)
        self.browser.find_element_by_id("reglForm.email").clear()
        self.browser.find_element_by_id("reglForm.email").send_keys(self.mailaddr)
        self.browser.find_element_by_id("reglForm.password").clean()
        self.browser.find_element_by_id("reglForm.password").send_keys(self.passwd)
        self.browser.find_element_by_id("reglForm.confirmPassword").clear()
        self.browser.find_element_by_id("reglForm.confirmPassword").send_keys(self.passwd)
        sleep(8)
        self.browser.find_element_by_link_text ("立即注册").click()
    
    class add_domain_info(object):
        def __init__(self,username,password,domainName,originlp):
            self.browser = webdriver.Firefox()
            self.username = username
            self.password = password
            self.domainName = domainName
            self.originlp = originlp
            self.url = 'https://www.xxx.com/cn/index.html'
    
        def add_info(self):
            '''登陆部分'''
            self.browser.get(self.url)
            self.browser.maximize_window()
            self.browser.implicitly_wait(10)
            self.browser.find_element_by_link_text("登录").click()
            self.browser.implicitly_wait(10)
            self.browser.find_element_by_id("username").clean()
            self.browser.find_element_by_id("username").send_keys(self.username)
            self.browser.find_element_by_id("password").clean()
            self.browser.find_element_by_id("password").send_keys(self.password)
            sleep(8) #输验证码
            self.browser.find_element_by_id("loginBtn").click()
            self.browser.implicitly_wait(10)
    
            '''新增加速域名'''
            self.browser.find_element_by_link_text("xxxx").click()
            self.browser.implicitly_wait(3)
            self.browser.find_element_by_link_text("xxxx").click()
            self.browser.find_element_by_id("xxxx).clear()
            self.browser.find_element_by_id("xxxx").send_keys(self.domainName)
            self.browser.find_element_by_id("xxxxx").clear()
            self.browser.find_element_by_id("xxxxx").send_keys(self.oniginlp)
            self.browser.find_element_by_class_name("saddd").click()
            self.browser.implicitly_wait(3)
    
            #可有些问题
    
            self.browser.find_element_by_name("xxx").send_keys("xxxx")
            self.browser.find_element_by_name("xxxx").send_keys("xxx")
            self.browser.find_element_by_link_text("xxxx").click()
            self.browser.find_element_by_link_text("xxx").click()
    
        class modify_domain_info(object):
            def __init__(self):
                pass
    
    test = add_domain_info('cntanght@163.com','xxxxx','www.baidu.com、'1.0.0.1’)
    test.add_info()
  • 相关阅读:
    pyinstaller相关用法
    yield 与 yield from
    async /await相关知识理解
    调试程序方法pdb
    任务22-4
    任务22-2
    跳台阶
    计算三维空间某点距离原点的欧式距离
    质数判断
    罗马数字转换
  • 原文地址:https://www.cnblogs.com/zidonghua/p/7439687.html
Copyright © 2011-2022 走看看