問題:用戶portal支持https協(xié)議,用loadrunner錄制登陸腳本時發(fā)現(xiàn)未錄制到用戶名和密碼 錄制到的腳本如下: login() { lr_think_time(10); web_url("verifycode.jsp", "URL=https://192.168.211.246:56661/portal/common/jsp/verifycode.jsp?codeSource=loginverifycode&time=1330596177343", "Resource=1", "RecContentType=image/jpeg", "Referer=https://192.168.211.246:56661/portal/indexAction", "Snapshot=t2.inf", LAST); web_url("192.168.211.246:38787_2", "URL=http://192.168.211.246:38787/", "Resource=0", "RecContentType=text/html", "Referer=https://192.168.211.246:56661/portal/indexAction", "Snapshot=t3.inf", "Mode=HTML", EXTRARES, "Url=https://192.168.211.246:56661/portal/common/style/image/head/topbg_line.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/shadowLW.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/tabM.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/tabBg.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/shadowRW.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/titleHot.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/head/contanta_pic_y.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/titleHot2.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/shadowB.jpg", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, "Url=https://192.168.211.246:56661/portal/common/style/image/titleMyoder.gif", "Referer=https://192.168.211.246:56661/portal/indexAction", ENDITEM, LAST); web_url("subscribeInfoQuery.action", "URL=https://192.168.211.246:56661/portal/subscribeInfoQuery.action", "Resource=0", "RecContentType=text/html", "Referer=https://192.168.211.246:56661/portal/indexAction", "Snapshot=t4.inf", "Mode=HTML", LAST); return 0; } 思考:是否是loadrunner不支持https 解決:通過查找一些資料,其實loadrunner支持https協(xié)議,但需要在錄制腳本時做一些修改,操作步驟如下: 1、證書的準備 常見的證書為:*.pfx格式,該種格式的證書可以通過雙擊運行安裝到IE瀏覽器上。用戶在訪問的時候就可以使用到。 但這種證書并不是LoadRunner所使用的類型,因此需要對其進行轉(zhuǎn)換。將其轉(zhuǎn)換為*.pem格式。 轉(zhuǎn)換方法如下: a) 安裝openssl后 b) 運行C:\<OpenSSL>/bin文件夾的openssl二進制文件,它將啟動OpenSSL命令提示符 c) 執(zhí)行以下命令:pkcs12 -in D:\test1.pfx -out D:\test01.pem–nodes d) 執(zhí)行后,將會在指定目錄生成test01.pem文件,這個文件將會在下一個步驟,對LoadRunner進行配置的時候使用到。 2.LR配置 啟動LoadRunner,打開Recording Option選項。 [圖片] 留意紅色框中的選項。 選擇后,單擊New Enty [圖片] 紅框中的配置為服務器的ip和端口號,按照測試所需要的實際地址進行配置就可以 配置后,將Use specified client-side certificate[Base64/PEM]鉤選,為使用客戶端證書訪問。 單擊...選擇剛剛轉(zhuǎn)換生成的客戶端證書。 [圖片] 如果你為證書有設置密碼,在這里也需要輸入。 到此為止所有與http區(qū)別的配置就完成了。 錄制后,可以在腳本的開始,看到LoadRunner新生成的語句 web_set_certificate_ex(" CertFilePath=test01.pem", //密鑰文件 "CertFormat=PEM", "KeyFilePath=test01.pem", //密鑰文件 "KeyFormat=PEM", "Password=123456", //密鑰密碼 "CertIndex=1", LAST); 3、完成上面兩步后可以正常錄制腳本 |
|
來自: 昵稱13876790 > 《腳本學習》