def set_driver(self): #读取test.conf文件内容 fileList = fileRead().get_ip_address() #读取开关字符,0代表本地登录,1代表远程登录 ipAdd = fileList[3].strip('\n') if ipAdd == '0': return self.set_local_driver() elif ipAdd == '1': return self.set_remote_driver()
def choice_browser(self, iconType, username, pwd, cmdList): fileList = fileRead().get_ip_address() browserType = fileList[1].strip('\n') if browserType == '1': self.execute_chrome_key() elif browserType != '0' or browserType != '1': self.opt_cmd("\\testIsomp\\webElement\\sso\\sso_firefox.exe","", \ "","","") self.opt_cmd("\\testIsomp\\webElement\\sso\\sso_client.exe",iconType, \ username,pwd,cmdList)
def choice_browser_open(self,iconType,username,pwd,cmdList): fileList = fileRead().get_ip_address() browserType = fileList[1].strip('\n') if browserType == '1': time.sleep(5) self.ssoElem.execute_chrome_key() elif browserType != '0' or browserType != '1': self.ssoElem.opt_cmd("\\testIsomp\\webElement\\sso\\sso_firefox.exe","", "","","") time.sleep(3) self.ssoElem.opt_cmd("\\testIsomp\\webElement\\rule\\sso_command_open.exe",iconType, username,pwd,cmdList)
def choice_browser(self,iconType,username,pwd,cmdList): fileList = fileRead().get_ip_address() browserType = fileList[1].strip('\n') if browserType == '1': self.execute_chrome_key() elif browserType != '0' or browserType != '1' : self.opt_cmd("\\testIsomp\\webElement\\sso\\sso_firefox.exe","", \ "","","") self.opt_cmd("\\testIsomp\\webElement\\sso\\sso_client.exe",iconType, \ username,pwd,cmdList)
def open_driver(self): #读取test.conf文件内容 fileList = fileRead().get_ip_address() #设定IP地址 ipAdd = fileList[0].strip('\n') if "0" in fileList[1].strip('\n'): u'''打开IE驱动''' #指定ie的webdriver的路径 # ieDriver = fileList[1].strip('\n') # os.environ["webdriver.ie.driver"] = ieDriver # driver = webdriver.Ie(ieDriver) driver=webdriver.Ie() elif "1" in fileList[1].strip('\n'): u'''打开google驱动''' driver = webdriver.Chrome() # driver = webdriver.Chrome(fileList[3].strip('\n')) else: driver = webdriver.Firefox() # profileDir = "C:\Users\yy\AppData\Roaming\Mozilla\Firefox\Profiles\k70dxttd.default" # isProfile = webdriver.FirefoxProfile(profileDir) # time.sleep(5) # u'''打开火狐驱动''' # driver = webdriver.Firefox(isProfile) #IE窗口最大化 driver.maximize_window() #打开IP地址对应的网页 driver.get("https://" + ipAdd + "/fort") # time.sleep(5) #https访问时弹出安全警告页面后点击继续,0代表有安全警告,1代表没有安全警告 if "0" in fileList[2].strip('\n'): driver.get("javascript:document.getElementById('overridelink').click();") return driver
def open_driver(self): #读取test.conf文件内容 fileList = fileRead().get_ip_address() #设定IP地址 ipAdd = fileList[0].strip('\n') if "0" in fileList[1].strip('\n'): u'''打开IE驱动''' #指定ie的webdriver的路径 # ieDriver = fileList[1].strip('\n') # os.environ["webdriver.ie.driver"] = ieDriver # driver = webdriver.Ie(ieDriver) driver=webdriver.Ie() elif "1" in fileList[1].strip('\n'): u'''打开google驱动''' driver = webdriver.Chrome() # driver = webdriver.Chrome(fileList[3].strip('\n')) else: driver = webdriver.Firefox() # profileDir = "C:\Users\yy\AppData\Roaming\Mozilla\Firefox\Profiles\k70dxttd.default" # isProfile = webdriver.FirefoxProfile(profileDir) # u'''打开火狐驱动''' # driver = webdriver.Firefox(isProfile) #IE窗口最大化 driver.maximize_window() #打开IP地址对应的网页 driver.get("https://" + ipAdd + "/fort") # time.sleep(5) #https访问时弹出安全警告页面后点击继续,0代表有安全警告,1代表没有安全警告 if "0" in fileList[2].strip('\n'): driver.get("javascript:document.getElementById('overridelink').click();") return driver