#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()