def LoginDUT(): os.system('taskkill /im IEXPLORE.EXE') sleep(1) ie = PAMIE( ) sleep(0.1) ie.navigate(IP) sleep(0.5) ie.listBoxSelect('username',username) ie.textBoxSet('password',password) ie.buttonClick("OK") sleep(0.5)
url = 'http://www.sciencedirect.com/science?_ob=ArticleListURL&_method=list&_ArticleListID=987492397&_st=13&_acct=C000050221&_version=1&_urlVersion=0&_userid=10&md5=07b2ce065d4fbefa373c5267ca144469' counter = 0 #FormatHtml(ie.outerHTML(), counter) if not os.path.exists("urls.txt"): urlFile = open("urls.txt", 'w') urlFile.write(url + "\n") ie = PAMIE() ie.navigate(url) urls = [url] while ie.buttonClick('next'): url = ie.locationURL() print "NEXT page: ", url urlFile.write(url + "\n") urls.append(url) urlFile.close() print "IE operator OVER" else: urlFile = open("urls.txt", 'r') urls = [url for url in urlFile] oriurl = 'http://www.sciencedirect.com/science?_ob=ArticleListURL&_method=list&_ArticleListID=987492397&_st=13&_acct=C000050221&_version=1&_urlVersion=0&_userid=10&md5=07b2ce065d4fbefa373c5267ca144469' for url in urls: print url
ie.checkBoxSet('basic-rate.wlan1.2',0) ie.checkBoxSet('basic-rate.wlan1.3',0) ie.checkBoxSet('basic-rate.wlan1.4',0) ie.checkBoxSet('basic-rate.wlan1.5',0) ie.checkBoxSet('basic-rate.wlan1.6',1) ie.checkBoxSet('basic-rate.wlan1.7',0) ie.checkBoxSet('basic-rate.wlan1.8',0) ie.checkBoxSet('basic-rate.wlan1.9',1) ie.checkBoxSet('basic-rate.wlan1.10',1) ie.checkBoxSet('basic-rate.wlan1.11',1) thread.start_new_thread(click_ok,(1,)) #click Update button ie.buttonClick('Update') sleep(10) ##11b 11g ssid settings ''' ie.navigate("http://"+IP+"/admin.cgi?action=vwn") ie.listBoxSelect('radioInterface','2') #ie.checkBoxSet('wlan1vwn_enabled_0',1) ie.textBoxSet('wlan1vlans.0.interface.ssid',SSID) #11g ie.checkBoxSet('wlan1vlans.0.bss.ignore-broadcast-ssid',1)# ##encryption settings
from cPAMIE import PAMIE ie = PAMIE() ie.navigate("www.google.com") ie.textBoxSet("q", "python") ie.buttonClick("btnG")
def G54S(config): ie = PAMIE() wga = winGuiAuto mp = cModalPopUp ie.navigate("http://" + IP + "/advance/advance-lan-wireless.htm") login = wga.findTopWindow(wantedText="Connect to " + IP) credential = wga.findControl(login, wantedClass="SysCredential") user1 = wga.findControl(credential, wantedClass="ComboBoxEx32") user2 = wga.findControl(user1, wantedClass="ComboBox") user3 = wga.findControl(user2, wantedClass="Edit") wga.setEditText(user3, username) ## If password is not null,enter password by win32api.keybd_event ## First enter Alt+p win32api.keybd_event(18, 0, 0, 0) win32api.keybd_event(80, 0, 0, 0) win32api.keybd_event(18, 0, win32con.KEYEVENTF_KEYUP, 0) win32api.keybd_event(80, 0, win32con.KEYEVENTF_KEYUP, 0) ##Then enter password """win32api.keybd_event(82,0,0,0) win32api.keybd_event(82,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(79,0,0,0) win32api.keybd_event(79,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(79,0,0,0) win32api.keybd_event(79,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(84,0,0,0) win32api.keybd_event(84,0,win32con.KEYEVENTF_KEYUP,0) time.sleep(10)""" OKButton = wga.findControl(login, wantedClass="Button", wantedText="OK") wga.clickButton(OKButton) ie.navigate("http://" + IP + "/advance/ad-lan-wireless_g.htm") ie.radioButtonSet("wl_radio", "1", checked=True) if config["wirelessmode"] == "802.11b only": wirelessmode = "11b-Only" elif config["wirelessmode"] == "802.11g only": wirelessmode = "11g-Only" elif config["wirelessmode"] == "802.11b/g": wirelessmode = "Mixed" ie.listBoxSelect("wl_gmode", wirelessmode) SSID = config["SSID"] ie.textBoxSet("wl_ssid_input", SSID) if config["autochannel"] == "Disable": ie.checkBoxSet("wl_channel_auto", 0) else: ie.checkBoxSet("wl_channel_auto", 1) channel = config["channel"] ie.listBoxSelect("wl_channel", "Channel " + channel) ie.buttonClick("Apply") time.sleep(10) ie.navigate("http://" + IP + "/advance/ad-lan-wireless_sec_g.htm") ie.radioButtonSet("wl_closed", "0", checked=True) encryption = config["encryption"] if encryption == "None": ie.radioButtonSet("wl_wep", "off", checked=True) elif encryption == "WEP": ie.radioButtonSet("wl_wep", "restricted", checked=True) keyindex = config["keyindex"] keytype = config["keytype"] wepkey = config["wepkey"] ie.radioButtonSet("wl_key", keyindex, checked=True) ie.listBoxSelect("wep_ascii_select" + keyindex, keytype) ie.textBoxSet("wl_key" + keyindex, wepkey) elif encryption == "TKIP": ie.radioButtonSet("wl_wep", "tkip", checked=True) ie.textBoxSet("wl_wpa_psk", config["passphrase"]) elif encryption == "AES": ie.radioButtonSet("wl_wep", "aes", checked=True) ie.textBoxSet("wl_wpa_psk", config["passphrase"]) ie.buttonClick("Apply") time.sleep(10)
def Dlink_DWL_8500AP(config): ie = PAMIE() wga = winGuiAuto # ie.navigate("http://"+IP+"/admin.cgi?action=basic_settings") ie.navigate("http://" + IP) login = wga.findTopWindow(wantedText="Connect to " + IP) credential = wga.findControl(login, wantedClass="SysCredential") # find by spi user1 = wga.findControl(credential, wantedClass="ComboBoxEx32") # combin combo and edit user2 = wga.findControl(credential, wantedClass="ComboBox") user3 = wga.findControl(credential, wantedClass="Edit") wga.setEditText(user3, username) """ ## First enter Alt+p win32api.keybd_event(18,0,0,0) win32api.keybd_event(80,0,0,0) win32api.keybd_event(18,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(80,0,win32con.KEYEVENTF_KEYUP,0) ##Then enter password admin win32api.keybd_event(97,0,0,0) #a win32api.keybd_event(97,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(100,0,0,0) #d win32api.keybd_event(100,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(109,0,0,0)#m win32api.keybd_event(109,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(105,0,0,0)#i win32api.keybd_event(105,0,win32con.KEYEVENTF_KEYUP,0) win32api.keybd_event(110,0,0,0)#n win32api.keybd_event(110,0,win32con.KEYEVENTF_KEYUP,0) sleep(10) """ # user4=wga.findControl(credential,wantedClass='Edit') # wga.setEditText(user4,password) # click login buttion OKButton = wga.findControl(login, wantedClass="Button", wantedText="OK") wga.clickButton(OKButton) ##set channel channel = config["channel"] ie.listBoxSelect("radio.wlan1.channel", channel) # select 11bg mode ie.navigate("http://" + IP + "/admin.cgi?action=radio") ie.listBoxSelect("radioInterface", "2") ie.listBoxSelect("radio.wlan0.mode", "IEEE 802.11g") sleep(1) if config["wirelessmode"] == "802.11b only": ie.checkBoxSet("supported-rate.wlan1.0", 0) ie.checkBoxSet("supported-rate.wlan1.1", 0) ie.checkBoxSet("supported-rate.wlan1.2", 0) ie.checkBoxSet("supported-rate.wlan1.3", 0) ie.checkBoxSet("supported-rate.wlan1.4", 0) ie.checkBoxSet("supported-rate.wlan1.5", 0) ie.checkBoxSet("supported-rate.wlan1.6", 1) ie.checkBoxSet("supported-rate.wlan1.7", 0) ie.checkBoxSet("supported-rate.wlan1.8", 0) ie.checkBoxSet("supported-rate.wlan1.9", 1) ie.checkBoxSet("supported-rate.wlan1.10", 1) ie.checkBoxSet("supported-rate.wlan1.11", 1) ie.checkBoxSet("basic-rate.wlan1.0", 0) ie.checkBoxSet("basic-rate.wlan1.1", 0) ie.checkBoxSet("basic-rate.wlan1.2", 0) ie.checkBoxSet("basic-rate.wlan1.3", 0) ie.checkBoxSet("basic-rate.wlan1.4", 0) ie.checkBoxSet("basic-rate.wlan1.5", 0) ie.checkBoxSet("basic-rate.wlan1.6", 0) ie.checkBoxSet("basic-rate.wlan1.7", 0) ie.checkBoxSet("basic-rate.wlan1.8", 0) ie.checkBoxSet("basic-rate.wlan1.9", 0) ie.checkBoxSet("basic-rate.wlan1.10", 1) ie.checkBoxSet("basic-rate.wlan1.11", 1) elif config["wirelessmode"] == "802.11g only": ie.checkBoxSet("supported-rate.wlan1.0", 1) ie.checkBoxSet("supported-rate.wlan1.1", 1) ie.checkBoxSet("supported-rate.wlan1.2", 1) ie.checkBoxSet("supported-rate.wlan1.3", 1) ie.checkBoxSet("supported-rate.wlan1.4", 1) ie.checkBoxSet("supported-rate.wlan1.5", 1) ie.checkBoxSet("supported-rate.wlan1.6", 0) ie.checkBoxSet("supported-rate.wlan1.7", 1) ie.checkBoxSet("supported-rate.wlan1.8", 1) ie.checkBoxSet("supported-rate.wlan1.9", 0) ie.checkBoxSet("supported-rate.wlan1.10", 0) ie.checkBoxSet("supported-rate.wlan1.11", 0) ie.checkBoxSet("basic-rate.wlan1.0", 0) ie.checkBoxSet("basic-rate.wlan1.1", 0) ie.checkBoxSet("basic-rate.wlan1.2", 0) ie.checkBoxSet("basic-rate.wlan1.3", 1) ie.checkBoxSet("basic-rate.wlan1.4", 0) ie.checkBoxSet("basic-rate.wlan1.5", 1) ie.checkBoxSet("basic-rate.wlan1.6", 0) ie.checkBoxSet("basic-rate.wlan1.7", 0) ie.checkBoxSet("basic-rate.wlan1.8", 1) ie.checkBoxSet("basic-rate.wlan1.9", 0) ie.checkBoxSet("basic-rate.wlan1.10", 0) ie.checkBoxSet("basic-rate.wlan1.11", 0) elif config["wirelessmode"] == "802.11b/g": ie.checkBoxSet("supported-rate.wlan1.0", 1) ie.checkBoxSet("supported-rate.wlan1.1", 1) ie.checkBoxSet("supported-rate.wlan1.2", 1) ie.checkBoxSet("supported-rate.wlan1.3", 1) ie.checkBoxSet("supported-rate.wlan1.4", 1) ie.checkBoxSet("supported-rate.wlan1.5", 1) ie.checkBoxSet("supported-rate.wlan1.6", 1) ie.checkBoxSet("supported-rate.wlan1.7", 1) ie.checkBoxSet("supported-rate.wlan1.8", 1) ie.checkBoxSet("supported-rate.wlan1.9", 1) ie.checkBoxSet("supported-rate.wlan1.10", 1) ie.checkBoxSet("supported-rate.wlan1.11", 1) ie.checkBoxSet("basic-rate.wlan1.0", 0) ie.checkBoxSet("basic-rate.wlan1.1", 0) ie.checkBoxSet("basic-rate.wlan1.2", 0) ie.checkBoxSet("basic-rate.wlan1.3", 0) ie.checkBoxSet("basic-rate.wlan1.4", 0) ie.checkBoxSet("basic-rate.wlan1.5", 0) ie.checkBoxSet("basic-rate.wlan1.6", 1) ie.checkBoxSet("basic-rate.wlan1.7", 0) ie.checkBoxSet("basic-rate.wlan1.8", 0) ie.checkBoxSet("basic-rate.wlan1.9", 1) ie.checkBoxSet("basic-rate.wlan1.10", 1) ie.checkBoxSet("basic-rate.wlan1.11", 1) thread.start_new_thread(click_ok, (1,)) ie.buttonClick("Update")