VFP 愛用者社區 首頁 VFP 愛用者社區
本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
 
 常見問題常見問題   搜尋搜尋   會員列表會員列表   會員群組會員群組   會員註冊會員註冊 
 個人資料個人資料   登入檢查您的私人訊息登入檢查您的私人訊息   登入登入

用程式開啟ie連結到某網頁後,如何自動輸入帳號與密碼並按下登入按鈕??
前往頁面 1, 2  下一頁
 
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區
上一篇主題 :: 下一篇主題  
發表人 內容
ufochen



註冊時間: 2003-09-17
文章: 165


第 1 樓

發表發表於: 星期一 五月 16, 2011 12:28 pm    文章主題: 用程式開啟ie連結到某網頁後,如何自動輸入帳號與密碼並按下登入按鈕?? 引言回覆

用程式開啟ie連結到某網頁後,程式碼如下 :
Public ieMonitor
ieMonitor = Createobject("InternetExplorer.Application")
ieMonitor.Navigate("http://211.72.203.71")
ieMonitor.Visible = .T. && 至此...IE 登入畫面出現

請問一下, 如何用程式自動輸入帳號與密碼並按下登入按鈕??
回頂端
檢視會員個人資料 發送私人訊息
whh



註冊時間: 2010-04-16
文章: 166


第 2 樓

發表發表於: 星期一 五月 16, 2011 3:18 pm    文章主題: Re: 用程式開啟ie連結到某網頁後,如何自動輸入帳號與密碼並按下登入按鈕?? 引言回覆

ufochen 寫到:
用程式開啟ie連結到某網頁後,程式碼如下 :
Public ieMonitor
ieMonitor = Createobject("InternetExplorer.Application")
ieMonitor.Navigate("http://211.72.203.71")
ieMonitor.Visible = .T. && 至此...IE 登入畫面出現

請問一下, 如何用程式自動輸入帳號與密碼並按下登入按鈕??


現在新版的瀏覽器登入好像都不能用get傳值,或是post傳值去做自動登入,
印象中好像說是安全性的問題。
回頂端
檢視會員個人資料 發送私人訊息
ufochen



註冊時間: 2003-09-17
文章: 165


第 3 樓

發表發表於: 星期三 五月 18, 2011 9:53 am    文章主題: Re: 用程式開啟ie連結到某網頁後,如何自動輸入帳號與密碼並按下登入按鈕?? 引言回覆

whh 寫到:
ufochen 寫到:
用程式開啟ie連結到某網頁後,程式碼如下 :
Public ieMonitor
ieMonitor = Createobject("InternetExplorer.Application")
ieMonitor.Navigate("http://211.72.203.71")
ieMonitor.Visible = .T. && 至此...IE 登入畫面出現

請問一下, 如何用程式自動輸入帳號與密碼並按下登入按鈕??


現在新版的瀏覽器登入好像都不能用get傳值,或是post傳值去做自動登入,
印象中好像說是安全性的問題。

謝謝 ! 那是不是說無法用程式自動登入,看來要放棄這樣的想法了 !
回頂端
檢視會員個人資料 發送私人訊息
Patrick Wu



註冊時間: 2007-01-03
文章: 223
來自: 台北市

第 4 樓

發表發表於: 星期三 五月 18, 2011 1:46 pm    文章主題: 引言回覆

後學的作法如下:

_SCREEN.WindowState = 1
_SCREEN.ControlBox = .F.
_SCREEN.MaxButton = .F.
_SCREEN.MinButton = .T.

oIE = CREATEOBJECT('internetexplorer.application')
oIE.NAVIGATE('http://......................................asp')
oIE.VISIBLE = .T. &&&& 帳號 密碼 的畫面 要顯示
DO WHILE oIE.BUSY OR oIE.READYSTATE <> 4
ENDDO

oIE.DOCUMENT.FORMS.form1.prno.VALUE = "........" === >>> 帳號
oIE.DOCUMENT.FORMS.form1.login.VALUE = ".........." === >>> 密碼
oIE.DOCUMENT.FORMS.form1.window.document.form1.submit() === >>> 自動執行

DO WHILE oIE.BUSY OR oIE.READYSTATE <> 4
ENDDO
回頂端
檢視會員個人資料 發送私人訊息 MSN Messenger
ufochen



註冊時間: 2003-09-17
文章: 165


第 5 樓

發表發表於: 星期四 五月 19, 2011 9:01 am    文章主題: 引言回覆

Patrick Wu 寫到:
後學的作法如下:

_SCREEN.WindowState = 1
_SCREEN.ControlBox = .F.
_SCREEN.MaxButton = .F.
_SCREEN.MinButton = .T.

oIE = CREATEOBJECT('internetexplorer.application')
oIE.NAVIGATE('http://......................................asp')
oIE.VISIBLE = .T. &&&& 帳號 密碼 的畫面 要顯示
DO WHILE oIE.BUSY OR oIE.READYSTATE <> 4
ENDDO

oIE.DOCUMENT.FORMS.form1.prno.VALUE = "........" === >>> 帳號
oIE.DOCUMENT.FORMS.form1.login.VALUE = ".........." === >>> 密碼
oIE.DOCUMENT.FORMS.form1.window.document.form1.submit() === >>> 自動執行

DO WHILE oIE.BUSY OR oIE.READYSTATE <> 4
ENDDO

謝謝 !不過還是不行 , 會出現錯誤訊息 ! 大大可以用這個網址幫我試試嗎?"http://211.72.203.71"我主要是要登入這個網站
回頂端
檢視會員個人資料 發送私人訊息
Patrick Wu



註冊時間: 2007-01-03
文章: 223
來自: 台北市

第 6 樓

發表發表於: 星期四 五月 19, 2011 1:43 pm    文章主題: 引言回覆

Sorry Ufochen 先進
我連網頁都 進不去 ACTIVE X 有問題
是否可將原始碼 E 給後學試試
回頂端
檢視會員個人資料 發送私人訊息 MSN Messenger
ufochen



註冊時間: 2003-09-17
文章: 165


第 7 樓

發表發表於: 星期四 五月 19, 2011 5:52 pm    文章主題: 引言回覆

該網頁原始碼如下 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Expires" content="Tue, 12 May 2001 1:00:00 GMT" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Content-type" content="text/html;" />
<link href="res/WebClient.ico" rel="SHORTCUT ICON" />

<title></title>
<script type="text/javascript">var WebClient;</script>
<script src ="server.js" type="text/javascript"></script>
<script src ="script/protocol.js" type="text/javascript"></script>
<script src ="script/main.js" type="text/javascript"></script>
<script src ="script/login.js" type="text/javascript"></script>
<script src ="script/flush_string.js" type="text/javascript"></script>
<script src ="script/Load_WebKit.js" type="text/javascript"></script>
<script src="logo/logo.js" type="text/javascript"></script>
<script src="css_style/uistyle.js" type="text/javascript"></script>
<script src ="script/ctrl_multi_edit.js" type="text/javascript"></script>


<link rel="stylesheet" type="text/css" href="css_style/mystyle.css">
<link rel="stylesheet" type="text/css" href="css_style/navigation.css">
<link rel="stylesheet" type="text/css" href="css_style/uistyle.css">



</head>
<body onresize="OnResize()"
onload="OnLoadPage()" onunload="OnUnloadPage()" onkeypress="OnBodyKeyDown()">
<div id="div_client" style="width: 992px; text-align: center; margin: 5px auto 0 auto;padding: 0; position: relative;">
<div id="work_area" style="display:none;">
<div id="div_main_menu" style="display: none;">
</div>
<div id="div_ocx" style="">
<div id="ocx_alt_label">
</div>
<object id='WebClient' classid='CLSID:9EF2BA47-C6A7-470D-9DD9-4323B0CB8353' width="100%"
height="100%" codebase="WebClient.cab#version=1,1,1,52">
</object>
</div>
<div id="div_live" style="display: none;">
</div>

<div id="div_playback" style="height: 608px;display: none;">
</div>
<div id="div_config" style="width: 980px; position: relative; display: none;
text-align: left; padding:1px;">
<div id="div_config_index" style="display: inline;">
</div>
<div id="div_config_body" style="display: inline;">
</div>
</div>
<!----- height: 100%蜊傖600px---->
<div id="div_search_body" style="width: 980px; position: relative;
display: none; ">
</div>
<div id="div_advance_body" style="width: 980px; height: 588px; position: relative;
text-align: left; display: none; padding:1px;">
</div>
<div id="div_backup_body" style="width: 980px; height: 600px; position: relative;
display: none; text-align: left;">
</div>
<div id="div_info" style="width: 978px; position: relative; display: none; text-align: left;
padding:1px;">
<div id="div_info_index" style="">
</div>
<div id="div_info_body" style="width: 780px; position: absolute; left: 190px; top: 0;
margin: 20px 0 0 0; padding: 0;">
</div>
</div>
</div>

<div id="div_login" style="margin: 0 auto; padding: 0; text-align: center; position: relative;
width: 100%; height: 638px; ">
<div id="win7_run_tip_div" style="color: Red; font-size: 18px; width: 770px; margin-top: 40px;
text-align: left; display: none;">
<label id="win7_run_tip">
</label>
</div>
<table style="margin:0 auto; text-align:center;" id="login_table">
<tr style="height:40px;">
<td id="login_user_label" style="width: 100px;display:none;"></td>
<td style="width: 200px;">
<input type="text" id="username" value="admin" style="width: 90%; overflow: hidden;display:none;" maxlength="32" onchange="userpwd.value = ''" />
</td>
</tr>
<tr style="height:40px;">
<td id="login_pwd_label" style="display:none;"></td>
<td>
<input type="password" id="userpwd" value="" maxlength="32" style="width: 90%; display:none;" /></td>
</tr>
<tr style="height:40px;">
<td id="login_language_label" style="display:none;"></td>
<td>
<select name="language_list" style="width: 90%; display:none;" onchange="OnChangeLang()" >
</select>
</td>
</tr>
<tr style="height:40px;">
<td></td>
<td>
<input id="login_ok_button" type="button" name="btn_login" value="LOGIN" onclick="OnLogin()"
style="width: 90%; display:none;" />
</td>
</tr>
</table>
</div>
</div>
<div id="id_wait" style="display: none;">
</div>
<iframe id="wait_iframe" style="position: absolute; z-index: 0; left: 0; top: 0;display: none; filter: alpha(opacity=40);opacity:0.4;"></iframe>
<img id="img_wait" style="position: absolute; display: none;" src="res/wait.gif" />
<div id="wait_tip_div" style="display: none;line-height: 50px;">
</div>
<div id="wait_tip_div_conn" style="display: none;">
<label id="wait_tip_conn_text"></label>
<img id="img_wait_conn" style="position: absolute; top:36px; left:118px; display: none;" src="res/wait.gif" />
</div>
</body>
</html>


ufochen 在 星期四 五月 19, 2011 6:02 pm 作了第 1 次修改
回頂端
檢視會員個人資料 發送私人訊息
ufochen



註冊時間: 2003-09-17
文章: 165


第 8 樓

發表發表於: 星期四 五月 19, 2011 5:59 pm    文章主題: 引言回覆

要調整ie的設定 , 把安全性頁面關於ActiveX控制項與外掛程式的相關選項設為啟用...
回頂端
檢視會員個人資料 發送私人訊息
janlih



註冊時間: 2003-11-04
文章: 69


第 9 樓

發表發表於: 星期五 五月 20, 2011 9:15 am    文章主題: 引言回覆

你好像少了 <form>....</form>
<form name="testform" method="post" action="xxxx">
.....
<input type="text" id="username" .....>
.....
<input type="password" id="userpwd" .....>
......
<input type="submit" name="submit2" value="登入">
</form>


你可以這樣試試

loie = Createobject('internetexplorer.application')
loie.NAVIGATE(你的website)
loie.visible = .T.
.....
loie.document.forms[0].username.value="xxx"
loie.document.forms[0].userpwd.value="xxxx"
loie.document.forms[0].submit()
.....

ps. forms[0]也可改為forms['testform']


janlih 在 星期五 五月 20, 2011 9:58 am 作了第 1 次修改
回頂端
檢視會員個人資料 發送私人訊息
ufochen



註冊時間: 2003-09-17
文章: 165


第 10 樓

發表發表於: 星期五 五月 20, 2011 9:54 am    文章主題: 引言回覆

[quote="janlih"]你好像少了 <form>....</form>
<form name="testform" method="post" action="xxxx">
......
<input type="submit" name="submit2" value="登入">
</form>


你可以這樣試試

loie = Createobject('internetexplorer.application')
loie.NAVIGATE(你的website)
loie.visible = .T.
.....
loie.document.forms[0].username.value="xxx"
loie.document.forms[0].password.value="xxxx"
loie.document.forms[0].submit()
.....

ps. forms[0]也可改為forms['testform'][/quote]

還是出現錯誤訊息
上面的原始檔,是在登入畫面時,按右鍵,選檢視原始檔(V),從檢視原始檔視窗複製過來的
確定沒有"<form>....</form>"
回頂端
檢視會員個人資料 發送私人訊息
janlih



註冊時間: 2003-11-04
文章: 69


第 11 樓

發表發表於: 星期五 五月 20, 2011 10:02 am    文章主題: 引言回覆

Error表示你語法有誤

你的username及password要用html裡的id名稱,不能照我的抄喔
回頂端
檢視會員個人資料 發送私人訊息
janlih



註冊時間: 2003-11-04
文章: 69


第 12 樓

發表發表於: 星期五 五月 20, 2011 10:07 am    文章主題: 引言回覆

<script src ="script/login.js" type="text/javascript"></script>
你可以調出script/login.js看看

這網頁的網址?
回頂端
檢視會員個人資料 發送私人訊息
ufochen



註冊時間: 2003-09-17
文章: 165


第 13 樓

發表發表於: 星期五 五月 20, 2011 10:17 am    文章主題: 引言回覆

加入 WAIT "" WINDOW TIMEOUT 5 這行
錯誤訊息變成這樣
回頂端
檢視會員個人資料 發送私人訊息
ufochen



註冊時間: 2003-09-17
文章: 165


第 14 樓

發表發表於: 星期五 五月 20, 2011 10:20 am    文章主題: 引言回覆

http://211.72.203.71
要調整ie的設定 , 把安全性頁面關於ActiveX控制項與外掛程式的相關選項設為啟用.
回頂端
檢視會員個人資料 發送私人訊息
janlih



註冊時間: 2003-11-04
文章: 69


第 15 樓

發表發表於: 星期五 五月 20, 2011 10:23 am    文章主題: 引言回覆

password應改為userpwd
loie.document.forms[0].userpwd.value="xxxx"
回頂端
檢視會員個人資料 發送私人訊息
從之前的文章開始顯示:   
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區 所有的時間均為 台北時間 (GMT + 8 小時)
前往頁面 1, 2  下一頁
1頁(共2頁)

 
前往:  
無法 在這個版面發表文章
無法 在這個版面回覆文章
無法 在這個版面編輯文章
無法 在這個版面刪除文章
無法 在這個版面進行投票
無法 在這個版面附加檔案
無法 在這個版面下載檔案


Powered by phpBB © 2001, 2005 phpBB Group
正體中文語系由 phpbb-tw 維護製作