Exemplo n.º 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)
Exemplo n.º 2
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"]')
Exemplo n.º 3
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"
         )
Exemplo n.º 4
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"]')
Exemplo n.º 5
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)
Exemplo n.º 6
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' )
Exemplo n.º 7
0
	def addRule(self):
		adapter.waitandSendkeys('//*[@id="RuleName"]', '123')
Exemplo n.º 8
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)
Exemplo n.º 9
0
	def login(self):
		adapter.waitandSendkeys('//*[@id="Pwd"]', self.login_pwd)
		adapter.waitandClick('//*[@id="Save"]')
Exemplo n.º 10
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"]')