Sign in to follow this  
Followers 0
Klexen

_IEFormElementSetValue

16 posts in this topic

I have a webform at work which I use send keys to login to. I would like to use _IEFormElementSetValue. I was wondering it it was possible on this kind of page.

This is the source that contrains username box

CODE
unction setCookie(name, value, path) {

// Setting a Javascript cookie with a specified path may cause problems

// with web proxies that rewrite URLs and HTTP headers.

// The path parameter is therefore ignored.

document.cookie = name + "=" + escape(value);

}

// login.js

// Copyright © 2001 - 2005 Citrix Systems, Inc. All Rights Reserved.

// Web Interface (Build 47648)

function clearForm(loginForm) {

loginForm.user.value = "";

loginForm.password.value = "";

if (loginForm.domain) {

if (loginForm.domain.type != "hidden") {

loginForm.domain.value = "";

}

}

if (loginForm.context != null) {

loginForm.context.value = "";

}

setDefaultFocus();

}

I tried this

$oBox = _IEFormGetObjByName($oIE, "loginForm.user.value")
    _IEFormElementSetValue($oBox, $Citrixuser)

Share this post


Link to post
Share on other sites



If you look through the site's source, you'll be searching for something in the form of "<FORM name = " to get the correct name parameter.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

Form name= is not there... But this is..

<td align='left' valign='top' nowrap>
                            <label id='lblUserName' class='xsNorm' for='user'
                                title="Enter your user name."
                            >
                            User name:
                            </label>
                          </td>
                        </tr>
                        <tr>
                          <td valign='top'>
                            <input type='text' name='user' id='user'
                                class='loginEntries'
                                maxlength='256' 

                                onkeyup='onUsernameTextEntry(this.form)'
                                onchange='onUsernameTextEntry(this.form)'
                            >
                          </td>
                        </tr>
                      </table>
                    </td>
                  </tr>
                  <tr>
                    <td>
                      <table border="0" cellspacing="0" cellpadding="2">

                        <tr>
                          <td align='left' valign='top' nowrap>
                            <label id='lblPasswd' class='xsNorm' for='password'
                                title="Enter your password."

Share this post


Link to post
Share on other sites

w00t! I got it!

$oForm2 = _IEFormGetCollection($oIE, 0)
    $o_login = _IEFormElementGetObjByName ($oForm2, "user")
    $o_password = _IEFormElementGetObjByName ($oForm2, "password")

    _IEFormElementSetValue ($o_login, $CitrixUser)
    _IEFormElementSetValue ($o_password, $Citrixpass)oÝ÷ Ù8b³
+çiz·ÞrÝ÷þ«¨µã¤k"7öhZ¾)àjènW¦Â+ajz-ê墧¥¨=¨²«qç(uæèÆ[mvz0­ª

I think it's not working because the page is split into frames.. And when you view source on the page it doesn't actually show that code. I had to copy and paste the fields in dreamweaver and get the source that way.

The source when you go to View Source when that main page is open.. Looks like this:

CODE

<html>

<head>

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

<META HTTP-EQUIV="Expires" CONTENT="-1">

<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8">

<title>

DellServ 6.17

</title>

<link Rel="StyleSheet" Href="../stylesheets/NG.css" Type="text/css">

<script language="Javascript">document.domain="dell.com"

var SavedDpsNumBuid = "";

var SavedRunMode = "null";

var SavedSvcTag = "";

var SavedHashKey = "null";

var SavedCaseNum = "";

var SavedDpsNum = "";

var _CTI = "dellservcti.us.dell.com:889";

var _MAINT = "dellservmaint.us.dell.com:900";

var _CALLBACK = "http://insideapp.jp.dell.com/cs/cbtool/index.asp?agentid=";

var _SEARCHNET = "http://insideapp.jp.dell.com/cs/searchnet/index.asp?agentid=";

var _CTIWindow;

</script>

<script language="Javascript" src="../js/MainScripts.js"></script>

<base target="top">

</head>

<body class="clsBody" nowrap>

<!-- Navigation Bar (Cookie Crumbs) -->

<table class="clsNavb script:" target="_self">Logon</a>

</td>

</tr>

</table>

</div> <!-- ender for ShowHideMenu -->

</td>

<!-- Black Vertical Bar -->

<td width="1px" class="clsMainVertBar" id="blackVertBar" height="100%">&nbsp;</td>

<!-- The Content Area -->

<td valign="top" align="left" width="100%" id="ContentArea">

<iframe id="ContentFrame" frameborder="0" width="100%" height="100%" scrolling="no" tabindex="-1" src="../html/Message.html"></iframe>

</td>

</tr>

</table>

<!-- Hidden frame for EMEA specific common routines: -->

<iframe id="EMEAUtils" frameborder="0" width="0" height="0" scrolling="no" tabindex="-1"></iframe>

<!-- Hidden input for for DSN serer -->

<input type="hidden" name="DSNroot" id="DSNroot" value="http://dsn.us.dell.com/DSNCR">

</body>

<!--"CONVERTED_APPLET"-->

<!-- HTML CONVERTER

<OBJECT

classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"

WIDTH = 1

HEIGHT = 1

NAME = Agnt

codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-win.cab#Version=1,4,0,0">

<PARAM NAME="code" VALUE="DcssAgnt.class" >

<PARAM NAME="archive" VALUE="../applet/DcssAgnt.jar">

<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">

<PARAM NAME="scriptable" VALUE="true">

<PARAM NAME="mayscript" VALUE="true">

<PARAM NAME="RUNMODE" VALUE="null">

</OBJECT>

<!--"END_CONVERTED_APPLET"-->

<APPLET CODE="DcssAgnt.class" WIDTH="1" HEIGHT="1" NAME="Agnt" MAYSCRIPT="true">

<PARAM NAME = "ARCHIVE" VALUE ="../applet/DcssAgnt.jar">

<PARAM NAME = "PERFSLEEP" VALUE ="1200000">

<PARAM NAME = "RUNMODE" VALUE ="null">

<PARAM NAME = "COUNTRY" VALUE = "">

<PARAM NAME = "REGION" VALUE = "">

</APPLET>

</html>

Share this post


Link to post
Share on other sites

A good way to get source is to use either _IEDocReadHTML or _IEBodyReadHTML. Could you try that and post the resulting HTML you get? It should contain the necessary info.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

A good way to get source is to use either _IEDocReadHTML or _IEBodyReadHTML. Could you try that and post the resulting HTML you get? It should contain the necessary info.

I did that, this is what I get..

CODE
<HTML><HEAD><TITLE>DellServ 6.17</TITLE>

<META http-equiv=Pragma content=no-cache>

<META http-equiv=Expires content=-1>

<META http-equiv=Content-Type content="text/html; charset=utf-8"><LINK href="../stylesheets/NG.css" type=text/css rel=StyleSheet>

<script language=Javascript>document.domain="dell.com"

var SavedDpsNumBuid = "";

var SavedRunMode = "null";

var SavedSvcTag = "";

var SavedHashKey = "null";

var SavedCaseNum = "";

var SavedDpsNum = "";

var _CTI = "dellservcti.us.dell.com:889";

var _MAINT = "dellservmaint.us.dell.com:900";

var _CALLBACK = "http://insideapp.jp.dell.com/cs/cbtool/index.asp?agentid=";

var _SEARCHNET = "http://insideapp.jp.dell.com/cs/searchnet/index.asp?agentid=";

var _CTIWindow;

</SCRIPT>

<script language=Javascript src="../js/MainScripts.js"></SCRIPT>

<BASE target=top></HEAD>

<BODY class=clsBody noWrap><!-- Navigation Bar (Cookie Crumbs) -->

<TABLE class=clsNavb script:" target=_self>Logon</A> </TD></TR></TBODY></TABLE></DIV><!-- ender for ShowHideMenu --></TD><!-- Black Vertical Bar -->

<TD class=clsMainVertBar id=blackVertBar width=1 height="100%">&nbsp;</TD><!-- The Content Area -->

<TD id=ContentArea vAlign=top align=left width="100%"><IFRAME id=ContentFrame tabIndex=-1 src="../html/Message.html" frameBorder=0 width="100%" scrolling=no height="100%"></IFRAME></TD></TR></TBODY></TABLE><!-- Hidden frame for EMEA specific common routines: --><IFRAME id=EMEAUtils tabIndex=-1 frameBorder=0 width=0 scrolling=no height=0></IFRAME><!-- Hidden input for for DSN serer --><INPUT id=DSNroot type=hidden value=http://dsn.us.dell.com/DSNCR name=DSNroot> <!--"CONVERTED_APPLET"--><!-- HTML CONVERTER

<OBJECT

classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"

WIDTH = 1

HEIGHT = 1

NAME = Agnt

codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-win.cab#Version=1,4,0,0">

<PARAM NAME="code" VALUE="DcssAgnt.class" >

<PARAM NAME="archive" VALUE="../applet/DcssAgnt.jar">

<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">

<PARAM NAME="scriptable" VALUE="true">

<PARAM NAME="mayscript" VALUE="true">

<PARAM NAME="RUNMODE" VALUE="null">

</OBJECT>

<!--"END_CONVERTED_APPLET"--><APPLET height=1 width=1 code=DcssAgnt.class name=Agnt MAYSCRIPT="true"><PARAM NAME="country" VALUE=""><PARAM NAME="runmode" VALUE="null"><PARAM NAME="region" VALUE=""><PARAM NAME="perfsleep" VALUE="1200000"></APPLET> </BODY></HTML>

Share this post


Link to post
Share on other sites

Are the login inputs inside an applet?


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

Are the login inputs inside an applet?

I guess that's what it looks like.... Is there anything that can be done to login without using send keys?

Share this post


Link to post
Share on other sites

Sorry, I don't think there is any easy way to do that, except the craptacular old Send().


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

You can manipulate the PARAM values on the APPLET, but that helps only if the applet exposes username and password in this way. You cannot tell from the source you have, so you would need source for the applet, documentation or use trial and error...

<PARAM NAME="country" VALUE="">

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Shouldn't any item within a html document displayed by an IE be accessible through addressing the relevant item of the HTML DOM? Dale? ^^

101011


[font="Courier New"][center]Me vs. 127.0.0.1 =>> 0:2But I never give up! >:-][/center][/font]

Share this post


Link to post
Share on other sites

This is the code when the within the app I believe.. Like when I copy and paste fields into dreamweaver the source reads...

CODE
<td nowrap="nowrap">User ID </td>

<td nowrap="nowrap"><input onkeypress="CheckKey('AN');" id="idUsrID" maxlength="8" size="16" name="idUsr" />

</INPUT>

</td>

</tr>

<tr>

<td nowrap="nowrap">Password </td>

<td nowrap="nowrap"><input onkeypress="CheckKey('NO');" id="idPassword" type="password" maxlength="10" size="16" value="" name="idPassword" />

</INPUT>

</td>

</tr>

<tr id="idBadgeLine">

<td id="idBadgeIDLabel" nowrap="nowrap">Badge ID </td>

<td nowrap="nowrap"><input onkeypress="CheckKey('AN');" id="idBadgeID" onfocus="this.select()" maxlength="10" size="16" name="idBadgeID" />

</INPUT>

</td>

Share this post


Link to post
Share on other sites

@Qualitybit - APPLET and OBJECT tags provide a way to host applications inside the HTML layout. The DOM only knows about the limited set of attributes that are generic to APPLET and OBJECT tags and not specific to the application. Primitive configuration and parameter passing is available to the application through the DOM using PARAM tags, but how/if they are used is up to the application.

@Klexen -- which is it? The source you just posted can be manipulated with the DOM, the APPLET in the previous post cannot (directly).

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

@Qualitybit - APPLET and OBJECT tags provide a way to host applications inside the HTML layout. The DOM only knows about the limited set of attributes that are generic to APPLET and OBJECT tags and not specific to the application. Primitive configuration and parameter passing is available to the application through the DOM using PARAM tags, but how/if they are used is up to the application.

@Klexen -- which is it? The source you just posted can be manipulated with the DOM, the APPLET in the previous post cannot (directly).

Dale

The source code I posted was source that is within the applet.. When you say that it cannot be manipulated directly.. What can I do to get around the applet? Is it possible to set text in those boxes through the applet?

Share this post


Link to post
Share on other sites

There is some confusion here. The two sets of HTML source cannot be related. An APPLET or OBJECT has the HTML source you displayed in the earlier post. If you dig further into the OBJECT, what you'll find is references to JAVA code, not to HTML input fields that describe anything about what you see inside an object.

I'd suggest that either the OBJECT has nothing to do with the situation or perhaps you are being confused by Frames or iFrames.

I'd suggest you do not try to figure this out using View Source, but rather use ConsoleWrite(_IEBodyReadHTML($oIE)) to examine the active DOM source and dig into frames if you find them -- $oFrame = _IEFrameGetObjByName($oIE, "framename") then ConsoleWrite(_IEBodyReadHTML($oFrame))

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0