Jump to content

Recommended Posts

Posted

Hi,

I want to automate the login web page to click user ID password screen.But the source code don't have the exact form name.

I attached the source code for that screen.Can any one help me to find the form name in that.

</script>

</head>

<body onload="return window_onload();">

<form action="/CookieAuth.dll?Logon" method="post" id="logonForm" autocomplete="off">

<input type="hidden" id="curl" name="curl" value="Z2F" />

<input type="hidden" id="flags" name="flags" value="0" />

<input type="hidden" id="forcedownlevel" name="forcedownlevel" value="0" />

<input type="hidden" id="formdir" name="formdir" value="3" />

<div id="wrapper">

<div id="header">

<img src="/CookieAuth.dll?GetPic?formdir=3&image=header3.jpg" />

</div>

<!--<div id="leftcol" style="width:15px; position:absolute; top:140; left:0px">

Can anyone please help on this issue.

Thanks.

Learning is Lifelong!
Posted

Full web source would be more helpfull !

Hi wakillon,

Thanks for ur reply.

I have attache dthe full source code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

<title>Sign in to EAS</title>

<meta http-equiv="Content-Type" content="text/html; CHARSET=utf-8">

<meta content="NOINDEX, NOFOLLOW" name="Robots">

<link href="/CookieAuth.dll?GetPic?formdir=3&image=logon_style.css" type="text/css" rel="stylesheet">

<script src="/CookieAuth.dll?GetPic?formdir=3&image=flogon.js" type="text/javascript"></script>

<style type="text/css">

body

{

text-align: center;

min-width: 985px;

}

#wrapper

{

width: 985px;

margin: 0 auto;

text-align: left;

}

#dhtmltooltip

{

position: absolute;

left: -300px;

width: 250px;

border: 1px solid black;

padding: 2px;

background-color: lightyellow;

visibility: hidden;

z-index: 100;

}

#dhtmlpointer

{

position:absolute;

left: -300px;

z-index: 101;

visibility: hidden;

}

</style>

<script type="text/javascript">

var a_fGzpEnbl = 1;

var g_fFcs = 1;

function window_onload()

{

var url=window.location.href;

if(url.indexOf("reason=0")==-1)

{

document.getElementById('infoMessage').innerHTML="Invalid User ID or Password";

}

else

{

document.getElementById('infoMessage').innerHTML="";

}

/*if (chkCookies())

{

ldCookie('username', 'password');

var expl1 = document.getElementById('expl1');

expl1.style.display = "";

var lnkHidedSection = document.getElementById('lnkHdSec');

lnkHidedSection.style.display = "none";

var lnkShowSection = document.getElementById('lnkShwSec');

lnkShowSection.style.display = "";

}*/

}

var offsetfromcursorX=12 //Customize x offset of tooltip

var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image

var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV

document.write('<img id="dhtmlpointer" src="/CookieAuth.dll?GetPic?formdir=3&image=arrow2.jpg">') //write out pointer image

var ie=document.all

var ns6=document.getElementById && !document.all

var enabletip=false

if (ie||ns6)

var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){

return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body

}

function ddrivetip(thetext, thewidth, thecolor){

if (ns6||ie){

if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"

if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor

tipobj.innerHTML=thetext

enabletip=true

return false

}

}

function positiontip(e){

if (enabletip){

var nondefaultpos=false

var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;

var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;

//Find out how close the mouse is to the corner of the window

var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20

var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX

var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu

if (rightedge<tipobj.offsetWidth){

//move the horizontal position of the menu to the left by it's width

tipobj.style.left=curX-tipobj.offsetWidth+"px"

nondefaultpos=true

}

else if (curX<leftedge)

tipobj.style.left="5px"

else{

//position the horizontal position of the menu where the mouse is positioned

tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"

pointerobj.style.left=curX+offsetfromcursorX+"px"

}

//same concept with the vertical position

if (bottomedge<tipobj.offsetHeight){

tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"

nondefaultpos=true

}

else{

tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"

pointerobj.style.top=curY+offsetfromcursorY+"px"

}

tipobj.style.visibility="visible"

if (!nondefaultpos)

pointerobj.style.visibility="visible"

else

pointerobj.style.visibility="hidden"

}

}

function hideddrivetip(){

if (ns6||ie){

enabletip=false

tipobj.style.visibility="hidden"

pointerobj.style.visibility="hidden"

tipobj.style.left="-1000px"

tipobj.style.backgroundColor=''

tipobj.style.width=''

}

}

document.onmousemove=positiontip

</script>

</head>

<body onload="return window_onload();">

<form action="/CookieAuth.dll?Logon" method="post" id="logonForm" autocomplete="off">

<input type="hidden" id="curl" name="curl" value="Z2F" />

<input type="hidden" id="flags" name="flags" value="0" />

<input type="hidden" id="forcedownlevel" name="forcedownlevel" value="0" />

<input type="hidden" id="formdir" name="formdir" value="3" />

<div id="wrapper">

<div id="header">

<img src="/CookieAuth.dll?GetPic?formdir=3&image=header3.jpg" />

</div>

<!--<div id="leftcol" style="width:15px; position:absolute; top:140; left:0px">

</div> -->

<div id="centercol" style="background-color:White; left:7px;width:970px; height:370px; position:relative; top:0; margin-top:10px;" >

<div id="leftimage" style="width:208; position:absolute">

<!--<img src="images/leftimage.jpg" height="370" />-->

</div>

<div id="LoginContent" style="margin-top:20px; margin-left:0px; width:560px; left:218px; position:relative">

<!-- <font style="font-size:12px; color:Black; font-family:Verdana; font-weight:bold"><br /><br />The EAS authentication service, introduced by technology facilitates its associates to single sign on to its enterprise applications.</font> -->

<br /><br />

<!-- <font style="font-size:12px; color:Gray; font-family:Verdana; font-weight:bold">After signing in, you will be redirected to the page you requested.</font><br /><br /> -->

<div id="logintable" style="width:560px; height:155px; border-color:LightGrey; border-style:solid; border-width:1px">

<table border=0>

<tr>

<td width="12" height="150" bgcolor="#6eac53"></td>

<td width="100"></td>

<td valign="top">

<table cellspacing="5">

<tr>

<td colspan="3" height="5"></td>

</tr>

<tr>

<td colspan="3" height="20"><font style="font-size:14px; color:#3a5173; font-family:Verdana; font-weight:bold">Sign in to xyz</font></td>

</tr>

<tr valign="top">

<td><font style="font-size:12px; color:Black; font-family:Verdana; font-weight:bold">User Id: </font></td>

<td>

<input id="username" name="username" type="text" style="width:160px;" />

</td>

<td >

<!--<asp:RequiredFieldValidator ID="userIdRequired" runat="server" ControlToValidate="txtUserName" ErrorMessage="User Id is required" Font-Names="Verdana" Font-Size="10px" Display="Dynamic"></asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID="userIdRegX" runat="server" ValidationExpression="[A-Za-z0-9\\_.]{2,15}" ControlToValidate="txtUserName" ErrorMessage="Enter User Id in domain\userid format" Font-Names="Verdana" Font-Size="10px" Display="Dynamic"></asp:RegularExpressionValidator> -->

</td>

</tr>

<tr valign="top">

<td><font style="font-size:12px; color:Black; font-family:Verdana; font-weight:bold">Password: </font></td>

<td>

<input id="password" onfocus="g_fFcs=0" type="password" name="password" style="width:160px;" />

</td>

<td>

<!--<asp:RequiredFieldValidator ID="passwordRequired" runat="server" ControlToValidate="txtPassword" ErrorMessage="Password is required" Font-Names="Verdana" Font-Size="10px"></asp:RequiredFieldValidator>-->

</td>

</tr>

<tr valign="top">

<td></td>

<td align="right">

<input class="btn" onmousedown="this.className='btnOnMseDwn'" id="SubmitCreds" onmouseover="this.className='btnOnMseOvr'" onclick="clkLgn()" onmouseout="this.className='btn'" type="submit" value="Log On" name="SubmitCreds" />

<!--<asp:ImageButton ID="btnLogin" runat="server" onclick="btnLogin_Click" AlternateText="Sign In >>" ImageUrl="~/images/signin.jpg" /> -->

</td>

<td align="left"><font style="font-size:11px; color:Red; font-family:Verdana; font-weight:bold"><label id="infoMessage" ></label></font><!--<asp:Literal ID="infoMessage" runat="server" ></asp:Literal>--></td>

</tr>

</table>

</td>

</tr>

</table>

</div>

<br />

<table>

<tr>

<td><img src="/CookieAuth.dll?GetPic?formdir=3&image=info.jpg" /></td>

<td valign="top">

<font style="font-size: 12px; color: Black; font-family: Verdana; font-weight: bold">

<a href="https://identity.xyz.com/">Forgot Password/Unlock account ?</a></font>

<br />

<font style="font-size: 10px; color: Black; font-family: Verdana; font-weight: normal">

If you are having difficulties with sign in, You can login to <a href="https://identity.xyz.com/"><b><u>Identity portal</u></b></a>

using your identity credentials to reset your network password & unlock your account

online. </font><font style="font-size: 10px; color: Black; font-family: Verdana;

font-weight: normal"></font>

<!-- <font style="font-size:12px; color:Black; font-family:Verdana; font-weight:bold">Having difficulties in signing in. Get <a href="#" onmouseover ="ddrivetip('If you are facing problem in signing in or in case of network account lock please call:\n Vnet:56666 | US 1 866 822 2024 | UK 44 207 531 9330#56666')" onmouseout ="hideddrivetip()" >Help?</a></font>

<font style="font-size:10px; color:Black; font-family:Verdana; font-weight:normal">

<br />Please use your network id and password to login.

<br />Please note that typing the incorrect password more than 3 times will lock your network account.

</font> -->

</td>

</tr>

</table>

</div>

</div>

<div id="footer" style="left:7px; background-image:url(/CookieAuth.dll?GetPic?formdir=3&image=bottomline.jpg); background-repeat:repeat-x; width:970px; position:relative; top:0px " >

<font style="font-size:10px; color:Black; font-family:Verdana; font-weight:normal"><br />All rights reserved &copy; xyz.technology.com.</font>

</div>

</div>

</form>

</body>

</html>

Learning is Lifelong!
Posted

You want this - <input id="password" onfocus="g_fFcs=0" type="password" name="password" style="width:160px;" />

This should work:

$oIE = _IECreate("https:site")

$oDoc = _IEDocGetObj($oIE)

$oArray = $oDoc.getElementsByTagName ("input")

For $element In $oArray

If $element.id="password" Then _IEFormElementSetValue($element, "pass")

If $element.id="username" Then _IEFormElementSetValue($element, "user1")

Next

Posted

Try this :

#include <IE.au3>

$sURL = "file:///" & @DesktopDir & "\source.html"
$oIE= _IECreate ( $sURL )
$colForms = _IEFormGetCollection ($oIE )

For $oForm In $colForms
    $oFormElements = _IEFormElementGetCollection ( $oForm )
    For $oFormElement In $oFormElements
        If $oFormElement.id = 'username' Then _IEFormElementSetValue ( $oFormElement, "username" )
        If $oFormElement.id = 'password' Then
            _IEFormElementSetValue ( $oFormElement, "password" )
            _IEFormSubmit ( $oForm, 0 )
            ExitLoop 2
        EndIf
    Next
Next

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Posted

You want this - <input id="password" onfocus="g_fFcs=0" type="password" name="password" style="width:160px;" />

This should work:

$oIE = _IECreate("https:site")

$oDoc = _IEDocGetObj($oIE)

$oArray = $oDoc.getElementsByTagName ("input")

For $element In $oArray

If $element.id="password" Then _IEFormElementSetValue($element, "pass")

If $element.id="username" Then _IEFormElementSetValue($element, "user1")

Next

Thanks Juvigy.The code works now..

Learning is Lifelong!
Posted

Try this :

#include <IE.au3>

$sURL = "file:///" & @DesktopDir & "\source.html"
$oIE= _IECreate ( $sURL )
$colForms = _IEFormGetCollection ($oIE )

For $oForm In $colForms
    $oFormElements = _IEFormElementGetCollection ( $oForm )
    For $oFormElement In $oFormElements
        If $oFormElement.id = 'username' Then _IEFormElementSetValue ( $oFormElement, "username" )
        If $oFormElement.id = 'password' Then
            _IEFormElementSetValue ( $oFormElement, "password" )
            _IEFormSubmit ( $oForm, 0 )
            ExitLoop 2
        EndIf
    Next
Next

Thanks for ur timely help..The code works fine.
Learning is Lifelong!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...