Avatar of Patrick Wrigley
Patrick Wrigley
Flag for United States of America asked on

using VBS script to log into internal website

I am using the vbs script below to attempt to fill in the user name and password for an internally hosted website.  I have 2 issues.
  1. it will fill in the user name and password but I can't seem to figure out how to get it to actually hit entre.
  2. I need to website to open in full screen mode (perhaps kiosk mode)
It is a windows 10 pro machine, not joined to the domain and attempting to log into a non domain web server

I am not married to vbs in this case and welcome ANY script I can put into the start up folder so that this machine starts up and logs into the webserver to display the security cameras it is hosting

Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "10.10.28.15"
IE.Visible = True

While IE.Busy
     WScript.Sleep 50
Wend

Set ipf = IE.document.all.username
ipf.Value = "admin" 
Set ipf = IE.document.all.password
ipf.Value = "111111"

Open in new window

Scripting Languages

Avatar of undefined
Last Comment
Patrick Wrigley

8/22/2022 - Mon
Bill Prew

On the screen that you enter the username and password on, is there a button to be pressed, if so that can be done in code?

It would be helpful if you could post up the "page source" when you browse to the login page in IE.  Use CRTL-U and then copy and paste the HTML source shown at the bottom of the screen.

~bp
Patrick Wrigley

ASKER
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>WEB SERVICE</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=6;IE=7; IE=8; IE=EmulateIE7"> <script type="text/javascript" src="jsBase/lib/jquery.js"></script> <script type="text/javascript" src="jsBase/widget/js/jquery.ui.core.js"></script> <script type="text/javascript" src="jsBase/widget/js/jquery.ui.widget.js"></script> <script type="text/javascript">jQuery.noConflict();</script> <script type="text/javascript" src="jsBase/lib/base64.js"></script> <script type="text/javascript" src="jsBase/lib/md5.js"></script> <script type="text/javascript" src="jsBase/lib/m1.2.js"></script> <script type="text/javascript" src="jsBase/lib/more.js"></script> <script type="text/javascript" src="jsBase/common/extend.js"></script> <script type="text/javascript" src="jsCore/rpcCore.js"></script> <script type="text/javascript" src="jsBase/lib/sea.js"></script> <script type="text/javascript" src="jsBase/lib/seajs-text.js"></script> <script type="text/javascript" src="jsCore/common.js"></script> <script type="text/javascript" src="js/publicFunc.js"></script> <script type="text/javascript" src="js/system.js"></script> <script type="text/javascript" src="js/loginEx.js"></script> <script type="text/javascript" src="/pluginVersion.js"></script> <script type="text/javascript" src="js/eventScript.js"></script> <script type="text/javascript">var g_NaclWin = null;
    var g_useApp = window.location.href.indexOf('fromWebChromeNACL') > 0;
    try {
        window.addEventListener('message', function (e) {
            console.log('webview: ' + e.data)
            // console.log(e.origin)
            // console.log(e.source)
            if (e.data == 'domready') {
                g_NaclWin = e.source;
                window.alert = webViewAlert;
                var frames = window.frames;
                for(var i = 0;i < frames.length;i++){
                    frames[i].alert = webViewAlert;
                }
                console.log('send back')
                e.source.postMessage('domready', '*');               
                if(g_ocx) g_ocx.SetTranslateString(jsonLang);
                return;
            }

            // console.log(e.data.method)
            if (typeof window[e.data.method] == 'function') {
                window[e.data.method].apply(this, e.data.params);
            } else {
                g_ocx.messageFromOcx(e.data);
            }
        }, false);
    } catch (e) {

    }
    
    var g_ocx = 0;
	var webcapDefer = jQuery.Deferred();
    seajs.config({
        base: './jsBase',
        paths: {
            'jsCore': '../jsCore',
            'html':'../html',
            'js':'../js'
        }
    });
    seajs.use('/jsCore/app', function (App) {
        window.webApp = new App();
        if(g_NaclWin) g_ocx.SetTranslateString(jsonLang);
        webApp.getWebCapAll().done(function(){
            webcapDefer.resolve();
        });
    });
    webApp = window.webApp;</script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript" src="/olp.js"></script> <script type="text/javascript" src="cap.js"></script>  <script type="text/javascript" src="js/appAbility.js"></script> <script type="text/javascript" src="/js/pluginAdaptor.js"></script> <link href="favicon.ico" type="image/x-icon" rel="shortcut icon"> <link rel="stylesheet" type="text/css" href="/jsBase/widget/css/ui.css"> <link rel="stylesheet" type="text/css" href="/jsBase/widget/css/skin.css"> <link rel="stylesheet" type="text/css" href="./css/reset.css"> <link rel="stylesheet" type="text/css" href="./css/ui.css"> <link type="text/css" rel="stylesheet" href="./css/custom.css"> <link rel="stylesheet" type="text/css" href="./css/fn.css"> <link rel="stylesheet" type="text/css" href="./css/skin.css"> <link rel="stylesheet" type="text/css" href="./css/index.css"> <link rel="stylesheet" type="text/css" href="./css/playbackindex.css"> <link rel="stylesheet" type="text/css" href="./css/oem.css"> </head> <body id="indexBody" onscroll="onScrollForNacl(true);$('nav_margin').style.visibility = 'hidden'; $('nav_margin').style.visibility = 'visible'">  <div id="loading" class="J_load_dialog"> <p id="lab_loading" class="J_load_p" t="com_msg.loading activex"></p> </div>   <div id="l" class="login" style="display:none"> <div class="loginbkg"> <div class="login-container"> <div class="login-content"> <div class="login-logo" id="index_logo"></div> <div class="login-inputbox fn-clear"> <form> <div class="login-input-item"> <label class="login-input-title oem_user_lable" t="com_str.username+: ">username</label> <input type="text" id="username" class="ui-input fn-width163 oem_user" onkeydown="if (event.keyCode==13) event.keyCode=9" maxlength="32"> <a t="com_str.login" class="ui-button fn-width80" onclick="login()" href="javascript:;" id="oem_login_id" style="margin-left:20px; display:none">login</a> </div> <div class="login-input-item" style="width:550px"> <label class="login-input-title" id="paswd" t="com_str.password+: ">password</label> <span id="passwordInput"> <input id="password" type="password" class="ui-input fn-width163 oem_pass" onkeydown="if (event.keyCode==13) login()" maxlength="32"> </span> <div class="ui-checkbox oem_loginShowPass" id="pswExpress_div" style="display:none"> <input type="checkbox" id="login_showpwd" onclick="showpassword()"> </div> <label class="ui-label-sub" t="com_str.plaintext" id="pswExpress_lab" style="display:none">showPass</label> <a t="com_button.comcanncel" class="ui-button fn-width80" onclick="$('password').value=''" href="javascript:;" id="oem_reset_id" style="margin-left:20px; display:none">reset</a> </div> <div class="login-input-item oem_ul_ltype" id="ul_ltype" style="display:none"> <label class="login-input-title" t="info_log.allTypes+: ">type:</label> <select class="fn-width169 oem_ltype" id="s_lgType"> <option value="0">TCP</option> <option value="4">UDP</option> <option t="conf_net.gui32_muticastset" value="3">multicast</option> </select> </div> <div class="login-input-item fn-padl190" id="ul_type"> <div class="ui-checkbox"><input id="net_lan" name="wtype" checked="checked" type="radio"></div> <label class="ui-label-sub" for="net_lan">LAN</label> <div class="ui-checkbox"><input id="net_wan" name="wtype" type="radio"></div> <label class="ui-label-sub" for="net_wan">WAN</label> </div> <div class="ui-button-box login-btnbox" id="ul_login_or_reset"> <a t="com_str.login" class="ui-button fn-width80 oem_loginCfm" onclick="login()" href="javascript:;">Login</a> <a t="com_button.comcanncel" class="ui-button fn-width80 oem_loginCancle" onclick="$('password').value=''" href="javascript:;">reset</a> </div> </form> </div> </div>  <div id="dlg_ModAdminPassword" class="ui-dialog fn-width475" style="top:-10000px"> <div class="ui-dialog-title"> <h1 id="modadmin_title">Modify Admin Password</h1> </div> <div class="ui-dialog-content"> <form> <div id="dlg_ModAdminPassword_lorex_msg" style="display:none;text-align:left;margin:5px;color:red"><span t="conf_account.passTip"></span></div> <div class="ui-form-item fn-clear"> <label t="com_str.username" class="ui-label fn-padl20">UerName</label> <input class="ui-input" value="admin" disabled="true"> </div> <div> <div class="ui-form-item fn-clear" id="oldPassword_div" style="display:none"> <label t="conf_account.oldpwd" class="ui-label fn-padl20">Old Password</label> <input class="ui-input" type="password" id="modadmin_oldPassword"> </div> <div class="ui-form-item fn-clear"> <label t="conf_account.newpwd" class="ui-label fn-padl20">New Password</label> <input class="ui-input" type="password" id="modadmin_newPassword"> <span class="ui-form-tip" id="modadmin_newPassword_remark" valign="middle"></span> </div> <div id="modadminPasswordLevel" class="fn-clear fn-marl140 fn-mart4 fn-marb4"> </div> <div class="ui-form-item fn-clear"> <label t="conf_account.confirmpwd" class="ui-label fn-padl20">Confirm Password</label> <input class="ui-input" type="password" id="modadmin_confirmPassword"> </div> </div> <div class="ui-form-item fn-clear" id="ipsanuserManage_diaModUser_username_title"> <label id="modadmin_security_tipsinfo" class="ui-label fn-width450"></label> </div> <div class="ui-button-box fn-padt10"> <a id="btn_admin_change" t="com_button.comok" class="ui-button" href="javascript:;">confirm</a> <a id="btn_admin_skip" t="com_button.comcanncel" class="ui-button" href="javascript:;">cancle</a> </div> <div class="ui-tip"> <div class="ui-tip-container" id="modadmin_remark"> <span class="ui-tip-icon"></span> <label></label> </div> </div> </form> </div> </div> <div id="dlg_weakPassword" class="ui-dialog fn-width475" style="top:-10000px"> <div class="ui-dialog-title"> <h1 id="weakPassword_title">Cancel Modify Admin Password Tip</h1> </div> <div class="ui-dialog-content"> <form> <div class="ui-form-item fn-clear"> <label t="conf_account.weak_password_tips" class="ui-label fn-padl20 fn-width410">Tip</label> </div> <div class="ui-form-item fn-clear"> <div class="fn-horizontal-line"></div> </div> <div class="ui-form-item fn-clear"> <div class="ui-checkbox fn-padl20"> <input type="checkbox" id="weakPassword_enable"> </div> <label t="conf_account.never_show_this" for="weakPassword_enable" class="ui-label fn-width370">Never Show This</label> </div> <div class="ui-button-box fn-padt10"> <a id="btn_weakPassword_yes" t="com_button.comok" class="ui-button" href="javascript:;">confirm</a> <a id="btn_weakPassword_cancel" t="com_button.comcanncel" class="ui-button" href="javascript:;">cancle</a> </div> </form> </div> </div> <div id="dlg_emptyPassword" class="ui-dialog fn-width475" style="top:-10000px"> <div class="ui-dialog-title"> <h1 id="emptyPassword_title">Admin Password Is Empty</h1> </div> <div class="ui-dialog-content"> <form> <div class="ui-form-item fn-clear"> <label t="ugm_msg.newPwdNull" class="ui-label fn-padl20 fn-width450">Tip</label> </div> <div class="ui-button-box fn-padt10"> <a id="btn_emptyPassword_yes" t="com_button.comok" class="ui-button" href="javascript:;">confirm</a> <a id="btn_emptyPassword_cancel" t="com_button.comcanncel" class="ui-button" href="javascript:;">cancle</a> </div> </form> </div> </div> </div> </div> </div>  <div id="login_install_dialog" class="login-webplugin" style="display:none"> <div class="ui-dialog-container" style="margin:auto"> <div t="com_msg.needActivex" style="font-size:200%" class="ui-dialog-content"> please install plugin </div> <div class="ui-button-box fn-padt20"> <a id="login_btn_install" class="ui-button" href="/LOREX_webplugin.exe" target="_download" t="com_str.install">install</a> <a id="login_btn_cancel" class="ui-button" href="javascript:;" t="com_button.comcanncel">cancle</a> </div> </div> </div> <div id="m" class="main-container"> <div class="main-head" id="nav_head"> <div class="main-logo" id="sub_logo"></div> <ul class="main-nav" id="nav"> <li id="b_a"> <a onclick="showPage('preview')" id="xyl" t="com_menu.title_preview" href="javascript:;" class="main-nav-item main-nav-item-current">preview</a> </li> <li id="b_ab"> <a onclick="showPage('playback')" id="xlxcx" t="com_menu.title_playback" href="javascript:;" class="main-nav-item">playback</a> </li> <li id="b_ac" style="display:none"> <a onclick="showPage('intelPlay')" id="xznhf" t="titles.intelliplay" href="javascript:;" class="main-nav-item">intel</a> </li> <li id="b_d"> <a onclick="showPage('alarm')" id="xbjsz" t="com_menu.title_alarm" href="javascript:;" class="main-nav-item">alarm</a> <div onclick="showPage('alarm')" class="main-nav-alarm" id="d_alarmtip" style="display:none"></div> </li> <li id="b_c"> <a onclick="showPage('setup')" id="xxtpz" t="com_menu.title_setup" href="javascript:;" class="main-nav-item">set</a> </li> <li id="b_x"> <a onclick="showPage('sysinfo')" id="xxinxi" t="titles.info" href="javascript:;" class="main-nav-item">info</a> </li> <li id="b_e"> <a onclick="webLogout()" t="com_menu.logout" href="javascript:;" class="main-nav-item">exit</a> </li> </ul> </div> <div id="nav_margin" style="height:13px;width:100%"></div> <div id="f_preview" class="pre-minwidth pos_abs"> <iframe src="" id="frame_preview" width="100%" height="100%" frameborder="0" scrolling="no" name="frame_preview" allowtransparency="true"></iframe> </div> <div id="f_playback" class="pre-minwidth pos_abs" style="top: -10000px">  </div> <div id="f_alarm" class="pre-minwidth pos_abs" style=""> <iframe src="" id="frame_alarm" width="100%" frameborder="0" scrolling="no" allowtransparency="true" style="min-width:1000px; min-height:530px" name="frame_alarm"></iframe> </div> <div id="setup" class="pre-minwidth pos_abs"> <div class="set-sidebar"> <ul id="setup-menu"></ul> </div> <div class="set-content"> <div id="setup-content" class="set-content-box"></div> </div> </div> <div id="info" class="pre-minwidth pos_abs"> <div class="set-sidebar"> <ul id="info-menu"></ul> </div> <div class="set-content"> <div id="info-content" class="set-content-box"></div> </div> </div> <div id="f_ocx" class="main-ocx"></div> </div> <div id="estopAll" style="display:none" class="estopAll"></div>  <div id="loadingCfg" class="J_load_dialog"> <p id="lab_loadingCfg" class="J_load_p"></p> </div> <script type="text/javascript">$('frame_preview').src = '/html/previewindex.htm?'+remoteParams.ALL;
	onPageIndexReady();</script> <script language="javascript" for="ocx" event="TransEvent(jsonStr)">handlerOcxEvents && handlerOcxEvents.fireOcxEvent(jsonStr);</script> <script language="javascript" for="ocx" event="SetNetPlayRecordStatus(result)">handlerOcxEvents && handlerOcxEvents.fileStatus(result);</script> <script language="javascript" for="ocx" event="SetNetPlayFileInfo(nChannel,strRecodInfo)">handlerOcxEvents && handlerOcxEvents.playFileInfo(nChannel, strRecodInfo);</script> <script language="javascript" for="ocx" event="NetPlayTimeInform(strTime)">handlerOcxEvents && handlerOcxEvents.NetPlayTimeInform(strTime);</script> <script language="javascript" for="ocx" event="StateChangedEx(nChannel, nState, nWinID, nStreamType)">handlerOcxEvents && handlerOcxEvents.StateChanged(nChannel, nState, nWinID, nStreamType);</script> <script language="javascript" for="timeaxes" event="BackUpBeginTimeChanged(strTime, nIndex)">handlerOcxEvents && handlerOcxEvents.BackUpBeginTimeChanged(strTime, nIndex);</script> <script language="javascript" for="timeaxes" event="BackUpEndTimeChanged(strTime, nIndex)">handlerOcxEvents && handlerOcxEvents.BackUpEndTimeChanged(strTime, nIndex);</script> <script language="javascript" for="timeaxes" event="OnOpenNetPlayByTime(nIndex, sTime)">handlerOcxEvents && handlerOcxEvents.OnOpenNetPlayByTime(nIndex, sTime);</script> <script language="javascript" for="ocx" event="FileDialogInfo(strFileName, strExt)">handlerOcxEvents && handlerOcxEvents.FileDialogInfo(strFileName, strExt);</script> <script language="javascript" for="ocx" event="InsertNetRecordFileInfo(nChannel, nEnd, strValue)">handlerOcxEvents && handlerOcxEvents.InsertNetRecordFileInfo(nChannel, nEnd, strValue);</script> <!--[if IE]><script type="text/javascript" src="jsCore/excanvas.js"></script><![endif]--> <script type="text/javascript" src="jsBase/widget/js/dui.fisheye.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.multiScreen.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.tab.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.table.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.tip.js"></script> <script type="text/javascript" src="Component/dui.barchart.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.pagination.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.textfield.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.numberfield.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.timefield.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.datepicker.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.dialog.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.progress.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.slider.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.ipfield.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.macfield.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.iconSelect.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.iconlist.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.select.js"></script> <script type="text/javascript" src="jsBase/widget/js/dui.loading.js"></script> <script type="text/javascript" src="Component/components.js"></script> <script type="text/javascript" src="Component/chnlGroup.js"></script> <script type="text/javascript" src="Component/schedule.js"></script> <script type="text/javascript" src="../Component/level.js"></script> </body> </html>

Open in new window

Patrick Wrigley

ASKER
I posted the webpage code and attached the full code in a text doc as well, thank you for looking
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Patrick Wrigley

ASKER
Full code text for the web servercode.txt
ASKER CERTIFIED SOLUTION
Bill Prew

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Patrick Wrigley

ASKER
fixed it...THANK YOU