Jump to content
Sign in to follow this  
Manu191357

Error on _IEFormElementSetValue

Recommended Posts

Hello,

I am trying to write a script for an automatic login to my asp.net web app.

This is how far I came:

#include <IE.au3>

call ("signIn")

Func signIn ()
Global $oIE = _IECreate ("http://mysite.net")

Local $username = _IEGetObjByName($oIE,"UserName")
Local $password = _IEGetObjByName($oIE,"Password")
Local $button =_IEGetObjById($oIE,"save")
_IEFormElementSetValue =($username,"xxxxxx")
_IEFormElementSetValue =($password,"xxxxx")

_IEAction ($button,"click")

EndFunc

IE is opened and the login page of my app is loaded. However at the line '_IEFormElementSetValue...' an error occurs.

Below is the html of my login page:

<html><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - xxxxx</title>
<link href="/Content/CustomTheme/Login.css" rel="stylesheet">
<script src="/Scripts/kendo/2018.2.620/jquery.min.js"></script>
<script src="/Scripts/kendo/2018.2.620/jszip.min.js"></script>
<script src="/Scripts/lib/amplify.min.js"></script>
</head>
<body>
<div id="body" class="container">
<div class="plate-shadow">
<div class="login-header">
<h1>Kunden-Login</h1>
</div>
<div id="loginUserForm">
<form action="/Identity/Login" id="signinForm" method="post"> <fieldset>
<div class="row clearfix">
<div class="label">
<label for="UserName">Bitte anmelden</label>
</div>
<div class="editor">
<input data-val="true" data-val-required="Der 'Login-Name' darf nicht leer sein!" id="UserName" name="UserName" placeholder="Username" type="text" value="">
</div>
</div>
<div class="row clearfix">
<div class="label">
<label for="Password">Kennwort</label>
</div>
<div class="editor">
<input id="Password" name="Password" type="password">
</div>
</div>
<div class="row clearfix">
<div class="label-checkbox">
<label for="StayLoggedInToday">Angemeldet bleiben?</label>
</div>
<input data-val="true" data-val-required="The StayLoggedInToday field is required." id="StayLoggedInToday" name="StayLoggedInToday" type="checkbox" value="true"><input name="StayLoggedInToday" type="hidden" value="false">
</div>
<div class="button">
<button id="save" type="submit" class="k-button">Anmelden</button>
</div>
</fieldset>
</form> </div>
</div>
<script>
    $(function () {
        function clearAmplifyStorage() {
            amplify.store("IsCompanySelected", false);
            amplify.store("SelectedItemId", null);
            amplify.store("SelectedItem", null);
            amplify.store("CompanyInfo", null);
            amplify.store("SelectedMenuItemId", null);
            amplify.store("CurrentMenuItemId", null);
        }

        clearAmplifyStorage();
    });
</script>
<div class="login-footer">
<div class="logoBottom">
<a href="#">XXXXXXX</a>
</div>
<div class="logoBottom-name">
Indire<span class="appendix">Kat</span>
</div>
<div class="copy">© 2018 <br>XXXXXXX</div>
</div>
</div>


</body></html>

Any idea what I am doing wrong?

Thanks for your help.

Regards, Manu

 

Share this post


Link to post
Share on other sites
8 minutes ago, Manu191357 said:

However at the line '_IEFormElementSetValue...' an error occurs.

It would be helpful to tell us the error you're getting. Otherwise everything we tell you is a guess.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

This is the output from the ouput panel:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\muehl\Documents\AutoIt\Test.au3"    
"C:\Users\muehl\Documents\AutoIt\Test.au3" (11) : ==> Error parsing function call.:
_IEFormElementSetValue =($username,"xxx.xxxxxxx.xxxx")
^ ERROR
>Exit code: 1    Time: 2.175

 

Share this post


Link to post
Share on other sites

@Manu191357

Replace the "=(" with "(" in the calling of _IEFormElementSetValue() :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@Manu191357

Happy to have helped :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...