#Coding:utf-8 fromTimeImportSleep fromSeleniumImportWebdriverclassCloudedge_register (object):def __init__(Self,mailaddr,passwd,url): Self.mailaddr=mailaddr self.passwd=passwd Self.url=URL Self.browser=Webdriver. Finefox ()defRegister (self): Self.browser.get (Self.url) Self.browser.maximize_window () self.browser.implicitly_wait (10) Self.browser.find_element_by_link_text ("Register"). 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 ("Register Now"). Click ()classAdd_domain_info (object):def __init__(SELF,USERNAME,PASSWORD,DOMAINNAME,ORIGINLP): Self.browser=Webdriver. Finefox () Self.username=username Self.password=Password Self.domainname=domainName SELF.ORIGINLP=ORIGINLP Self.url='https://www.xxx.com/cn/index.html' defAdd_info (self):" "Landing Section" "self.browser.get (Self.url) Self.browser.maximize_window () self.browser.implicitly_wait (10) Self.browser.find_element_by_link_text ("Login"). 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)#Verification Code for the transmissionSELF.BROWSER.FIND_ELEMENT_BY_ID ("loginbtn"). Click () self.browser.implicitly_wait (10) " "new accelerated domain name" "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) #there are some problems.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 ()classModify_domain_info (object):def __init__(self):PassTest= Add_domain_info ('[email protected]','xxxxx','www.baidu.com,'1.0.0.1') Test.add_info ()
Python+selenium Automated Software Testing (16th): Basic Combat (3)