Пример #1
0
 def networkSet_static(self):
     adapter.waitandClick('//*[@id="sel-opts-ulWanType"]/li[3]')
     adapter.waitandSendkeys('//*[@id="WanIpaddr"]', self.ip)
     adapter.waitandSendkeys('//*[@id="WanMask"]', self.subMask)
     adapter.waitandSendkeys('//*[@id="WanGw"]', self.gateway)
     adapter.waitandSendkeys('//*[@id="PrimDns"]', self.dns1)
     adapter.waitandSendkeys('//*[@id="SecDns"]', self.dns2)
Пример #2
0
	def portForward(self):
		adapter.clickApp()
		adapter.srcollAction('bottom')
		adapter.waitandClick('//*[@id="AppList"]/ul[4]/a[4]/li')
		if self.enable == '0':
			adapter.alwaysCloseSwitch('//*[@id="SwitchFwd"]', 'data-value')
		else :
			adapter.alwaysOpenSwitch('//*[@id="SwitchFwd"]')
			self.actionFun()
Пример #3
0
    def setDmz(self):
        adapter.clickApp()
        time.sleep(1)

        adapter.srcollAction('bottom')
        adapter.waitandClick('//*[@id="AppList"]/ul[5]/a[1]/li')
        adapter.alwaysOpenSwitch('//*[@id="Switch"]', 'data-value')
        adapter.waitandSendkeys('//*[@id="DmzIp"]', self.ip)
        adapter.waitandClick('//*[@id="Save"]')
Пример #4
0
    def upnp(self):
        adapter.clickApp()
        time.sleep(1)
        adapter.executeJS(
            "var q = document.getElementById('Content').scrollTop=10000")
        adapter.waitandClick('//*[@id="AppList"]/ul[5]/a[2]/li')

        if self.enable == '1':
            adapter.alwaysOpenSwitch('//*[@id="UpnpSwitch"]', 'data-value')
        else:
            adapter.alwaysCloseSwitch('//*[@id="UpnpSwitch"]', 'data-value')
Пример #5
0
	def parentCtrl(self):
		#adapter.waitandClick
		adapter.clickApp()
		adapter.waitandClick('//*[@id="AppList"]/ul[1]/a[4]/li')
		adapter.alwaysOpenSwitch('//*[@id="SwitchParent"]', 'data-value')
		adapter.waitforDisappear('//*[@id="Pop"]')
		if self.action == 'add':
			self.addRule()
		elif self.action == 'modify':
			self.modifyRule()
		elif self.action == 'delete':
			self.delRule()
		else :
			print("please input right action: add, modify, delete")
Пример #6
0
    def SeniorSet(self, flag=True):
        adapter.executeJS(
            "var q = document.getElementById('Content').scrollTop=10000")
        adapter.waitandClick('//*[@id="SeniorSet"]')
        adapter.waitandSendkeys('//*[@id="Mtu"]', self.mtu)
        adapter.executeJS(
            "var q = document.getElementById('Content').scrollTop=10000")

        if flag:
            adapter.alwaysOpenSwitch('//*[@id="Switch"]', 'data-value')
            adapter.executeJS(
                "var q = document.getElementById('Content').scrollTop=10000")
            adapter.waitandSendkeys('//*[@id="SeniorPrimDns"]', self.dns1)
            adapter.waitandSendkeys('//*[@id="SeniorSecDns"]', self.dns2)
Пример #7
0
    def networkSet(self):
        adapter.clickApp()
        adapter.executeJS(
            "var q = document.getElementById('Content').scrollTop=0")

        adapter.waitandClick('//*[@id="AppList"]/ul[1]/a[2]/li')
        adapter.waitandClick('//*[@id="WanType"]')

        if self.mode == 'dhcp':  #dhcp
            self.networkSet_dhcp()
        elif self.mode == 'pppoe':  #pppoe
            self.networkSet_pppoe()
        elif self.mode == 'static':  #static
            self.networkSet_static()
        else:
            adapter.writeadapterErrToLog('networkSet', 'input data error')
            print("please input right mode: dhcp, pppoe, static")
            return

        if self.moreSet == 'True':
            if self.mode == 'static':
                self.SeniorSet(flag=False)
            else:
                self.SeniorSet()

        adapter.executeJS(
            "var q = document.getElementById('Content').scrollTop=10000")
        adapter.waitandClick('//*[@id="Save"]')
Пример #8
0
 def backupRestore(self):
     adapter.clickApp()
     adapter.waitandClick('//*[@id="AppList"]/ul[2]/a[1]/li')
     if self.mode == '1':  #generate backup file
         adapter.waitandClick('//*[@id="BackupCfg"]')
     elif self.mode == '2':  #backup restore
         adapter.waitandSendkeys('//*[@id="ScanFile"]', self.backupFileDir)
     elif self.mode == '3':  #reset
         adapter.waitandClick('//*[@id="Reset"]')
         adapter.waitforDisplay('//*[@id="Pop"]')
         adapter.waitandClick('//*[@id="Pop"]/div/div/input[2]')
     else:
         print(
             "please set right mode: 1-generate backup file, 2-backup restore, 3-reset"
         )
Пример #9
0
	def changeUserPwd(self):
		adapter.waitandClick('//*[@id="Con"]/div[1]/ul[2]/li[1]')
		adapter.waitandClick('//*[@id="Con"]/div[1]/ul[2]/li[1]/ul/li[3]')
		adapter.waitforDisplay('//*[@id="_Widget"]')
		adapter.waitandSendkeys('//*[@id="PwdOld"]', self.pwdOld)
		adapter.waitandSendkeys('//*[@id="PwdNew"]', self.pwdNew)
		adapter.waitandSendkeys('//*[@id="PwdCfm"]', self.pwdNew)

		adapter.waitandClick('//*[@id="SavePwd"]')
Пример #10
0
 def diagnose(self):
     adapter.clickApp()
     adapter.waitandClick('//*[@id="AppList"]/ul[3]/a[1]/li')
     adapter.waitandClick('//*[@id="Start"]')
Пример #11
0
 def networkSet_pppoe(self):
     adapter.waitandClick('//*[@id="sel-opts-ulWanType"]/li[2]')
     adapter.waitandSendkeys('//*[@id="PppoeUser"]', self.pppoeUser)
     adapter.waitandSendkeys('//*[@id="PppoePwd"]', self.pppoePwd)
Пример #12
0
 def networkSet_dhcp(self):
     adapter.waitandClick('//*[@id="sel-opts-ulWanType"]/li[1]')
Пример #13
0
	def login(self):
		adapter.waitandSendkeys('//*[@id="Pwd"]', self.login_pwd)
		adapter.waitandClick('//*[@id="Save"]')
Пример #14
0
	def actionFun(self):
		if self.action == 'add':
			if adapter.elementIsDisplayed('//*[@id="FwdTab"]/ul'):
				adapter.waitandClick('//*[@id="FwdTab"]/ul')

			adapter.waitandSendkeys('//*[@id="RuleName"]', self.ruleName)
			adapter.waitandSendkeys('//*[@id="ServerIp"]', self.serverIP)
			adapter.waitandSendkeys('//*[@id="ExternalPort"]', self.outerPort)
			adapter.waitandSendkeys('//*[@id="InternalPort"]', self.innerPort)
			adapter.waitandClick('//*[@id="PortAgreement"]/span')
			if self.protocol == 'TCP':
				adapter.waitandClick('//*[@id="sel-opts-ulPortAgreement"]/li[1]')
			elif self.protocol == 'UDP':
				adapter.waitandClick('//*[@id="sel-opts-ulPortAgreement"]/li[2]')
			else:
				adapter.waitandClick('//*[@id="sel-opts-ulPortAgreement"]/li[3]')

			if adapter.elementIsDisplayed('//*[@id="SaveAdd"]'):
				adapter.waitandClick('//*[@id="SaveAdd"]')
			elif adapter.elementIsDisplayed('//*[@id="SaveEdit"]'):
				adapter.waitandClick('//*[@id="SaveEdit"]')
		else :
			arr = ["", self.ruleName, self.serverIP, self.outerPort, self.innerPort, self.protocol]
			row = adapter.getElementInTable('//*[@id="PortfwdTab"]','//*[@id="PortfwdTab"]/tbody', arr)
			if row == 0:
				print('no such line~~~')
			else:
				if self.action == 'del':
					xpath = '//*[@id="PortfwdTab"]/tbody/tr[%d]/td[6]/span[2]' % row
					adapter.waitandClick(xpath)
				elif self.action == 'modify':
					xpath = '//*[@id="PortfwdTab"]/tbody/tr[%d]/td[6]/span[1]' % row
					adapter.waitandClick(xpath)
				else:
					print('input right action')
					adapter.writeDataErrToLog('portForward', 'action', self.action, sys._getframe().f_lineno,\
					'please input right action: add, del, modify' )
Пример #15
0
    def guide(self):
        if (self.setPwd == 'True'):
            adapter.waitandClick('//*[@id="Start"]')
            adapter.waitandSendkeys('//*[@id="PwdNew"]', self.login_pwd)
            adapter.waitandSendkeys('//*[@id="PwdCfm"]', self.login_pwd)
            adapter.waitandClick('//*[@id="Save"]')
            time.sleep(1)
        else:
            login.main(loginData.login_data_1)

        #adapter.waitforDisplay('//*[@id="Pop"]')
        adapter.waitforDisappear('//*[@id="Pop"]')
        adapter.waitandClick('//*[@id="WanType"]/span')

        if self.network_mode == 'dhcp':
            adapter.waitandClick('//*[@id="sel-opts-ulWanType"]/li[1]')
        elif self.network_mode == 'pppoe':
            adapter.waitandClick('//*[@id="sel-opts-ulWanType"]/li[2]')
            adapter.waitandSendkeys('//*[@id="PppoeUser"]', self.pppoeUser)
            adapter.waitandSendkeys('//*[@id="PppoePwd"]', self.pppoePwd)
        elif self.network_mode == 'static':
            adapter.waitandClick('//*[@id="sel-opts-ulWanType"]/li[3]')
            adapter.waitandSendkeys('//*[@id="WanIpaddr"]', self.ip)
            adapter.waitandSendkeys('//*[@id="WanMask"]', self.subMask)
            adapter.waitandSendkeys('//*[@id="WanGw"]', self.gateway)
            adapter.waitandSendkeys('//*[@id="PrimDns"]', self.dns1)
        else:
            print("please input right mode: dhcp, pppoe, static")
            log.writeadapterErrToLog('guide', 'input data error')

        #adapter.waitandClick('//*[@id="Save"]')

        adapter.waitforDisappear('//*[@id="Pop"]')
        adapter.waitandSendkeys('//*[@id="Ssid2G"]', self.ssid_24G)
        adapter.waitandSendkeys('//*[@id="Pwd2G"]', self.pwd_24G)
        adapter.waitandSendkeys('//*[@id="Ssid5G"]', self.ssid_5G)
        adapter.waitandSendkeys('//*[@id="Pwd5G"]', self.pwd_5G)

        adapter.waitandClick('//*[@id="SaveReboot"]')