473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Login, fill in forms, logout

Can I do the following with Javascript?

My state has a web site that can be used for online filing for
unemployment benefits. Every week I have to go to the site and fill in
a form, checking off the same boxes each time. I'd like to automate
this.

I need to load the URL for the login page into the browser, fill in my
username and password, and submit the form. From that page I need to
follow a link to file for benefits. There I need to fill in the form by
checking a few boxes and submit the form. This brings up another form
where I have to confirm the entries. Then finally I can select the
Logout link.

How would I go about automating that with Javascript? I don't need
someone to write the whole thing, just provide the basic processes. I
had a similar question a few weeks ago, when I was trying to create a
bookmarklet to open my web banking page and prefill the account number,
but I was never able to solve it (I'm making do with two bookmarks -- a
regular one to open the page, and a bookmarklet to fill in the account#
field once the page is loaded). This makes me think that my plan for
the unemployment page won't work either, but there's no harm in asking.

--
Barry Margolin, ba****@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Jul 20 '05 #1
4 5346
Barry Margolin <ba****@alum.mit.edu> writes:

[fill in form]
How would I go about automating that with Javascript? I don't need
someone to write the whole thing, just provide the basic processes. I
had a similar question a few weeks ago, when I was trying to create a
bookmarklet to open my web banking page and prefill the account number,
but I was never able to solve it


Bookmarklets should do it. You should remember the size limit on
bookmarklets in IE if that is your browser (250 characters IIRC).

Example (make one line and change names to use):

javascript:var f=document.forms[0],v="value";f.name[v]="My name";
f.account[v]="My account";f.sometingElse.checked=true;
f.someSelect.seletedIndex=4;f.submit():

Using "[v]" instead of ".value" saves three characters each time
it is used, and cost 10 to declare, so you need to use it more than
three times for the shorthand to pay off.
If you need to use "selectedIndex" or "checked" more than once or
twice, make it a variable too, in the same way as v="value" . It's
all about saving space :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Lasse Reichstein Nielsen wrote:
Barry Margolin <ba****@alum.mit.edu> writes:

[fill in form]
How would I go about automating that with Javascript? I don't need
someone to write the whole thing, just provide the basic processes. I
had a similar question a few weeks ago, when I was trying to create a
bookmarklet to open my web banking page and prefill the account number,
but I was never able to solve it

Bookmarklets should do it. You should remember the size limit on
bookmarklets in IE if that is your browser (250 characters IIRC).

Example (make one line and change names to use):

javascript:var f=document.forms[0],v="value";f.name[v]="My name";
f.account[v]="My account";f.sometingElse.checked=true;
f.someSelect.seletedIndex=4;f.submit():

Using "[v]" instead of ".value" saves three characters each time
it is used, and cost 10 to declare, so you need to use it more than
three times for the shorthand to pay off.
If you need to use "selectedIndex" or "checked" more than once or
twice, make it a variable too, in the same way as v="value" . It's
all about saving space :)


IF that doesn't work, Visual Basic can do it, or you can use this program:

http://www.roboform.com/

Jul 20 '05 #3
In article <8y**********@hotpop.com>,
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote:
Barry Margolin <ba****@alum.mit.edu> writes:

[fill in form]
How would I go about automating that with Javascript? I don't need
someone to write the whole thing, just provide the basic processes. I
had a similar question a few weeks ago, when I was trying to create a
bookmarklet to open my web banking page and prefill the account number,
but I was never able to solve it
Bookmarklets should do it. You should remember the size limit on
bookmarklets in IE if that is your browser (250 characters IIRC).


I'm using Safari on Mac OS X 10.3.2 (so no Visual Basic, although I've
been wondering if AppleScript might work).
Example (make one line and change names to use):

javascript:var f=document.forms[0],v="value";f.name[v]="My name";
f.account[v]="My account";f.sometingElse.checked=true;
f.someSelect.seletedIndex=4;f.submit():

Using "[v]" instead of ".value" saves three characters each time
it is used, and cost 10 to declare, so you need to use it more than
three times for the shorthand to pay off.
If you need to use "selectedIndex" or "checked" more than once or
twice, make it a variable too, in the same way as v="value" . It's
all about saving space :)


Where in that bookmarklet does it go from page to page to page? After
submitting the login form, it needs to do the equivalent of clicking on
a link to get to the "file for benefits" form.

When I tried to write my previous bookmarklet, I tried assigning to
window.location to get it to load a new page, and then assign to the
form fields. The problem was that page loading happens asynchronously,
so the field assignments were being done *before* the page was actually
loaded (I could tell this was happening because if I ran the Javascript
while I was already looking at the form page, I could see it briefly
fill in the fields before reloading with an unfilled version of the
form).

What I need is a way to assign to window.location and then wait for the
browser to finish loading the page.

BTW, my ideal goal would be to do this all unattended. I'd like to set
up a cron job, so that every week this just happens automatically,
without me needing to click on anything at all. Since I'm using OS X,
which is Unix, if anyone has Unix CLI-based suggestions I'd be open to
that as well.

--
Barry Margolin, ba****@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Jul 20 '05 #4
Barry Margolin <ba****@alum.mit.edu> writes:
Where in that bookmarklet does it go from page to page to page?
It doesn't. You would then click another bookmarklet for the next page.
If youare using IE, you could look into a HTA-file, which is a HTML
file with extra permissions. Put the page you want into an iframe
and monitor it from the HTA-page.
BTW, my ideal goal would be to do this all unattended.
In that case, I wouldn't use a browser at all. Perhaps Perl, if you
know how :)
I'd like to set up a cron job, so that every week this just happens
automatically, without me needing to click on anything at all.


Definitly not a browser :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
2
by: Brian Henry | last post by:
We have our windows forms login set up and working good, well it works at least, just now we need a logout button, so when you click on it, the user will be logged out of the authentication, how...
1
by: MichaelR | last post by:
I have an asp.net application using forms authentication. 1. It has a simple login page (login.aspx) that uses FormsAuthentication.RedirectFromLoginPage(. . . ). 2. My application has a logout...
2
by: Shakun | last post by:
Hi All, This is my 1st posting to this group. Can any1 help me with the "Remember Me" which is there in a login form. Im pasting the code below. Im not able to set a cookie.. Thanks, Shakun...
1
by: Jakob Lithner | last post by:
When I started a new ASP project I was eager to use the login facilities offered in Framework 2.0/VS 2005. I wanted: - A custom principal that could hold my integer UserID from the database -...
0
by: Keithb | last post by:
I am using the login control on my web site, which has both authenticated an unauthenticated users. I added a logout page that is supposed to allow an authenticated user to drop his authentication...
1
by: Kandiman | last post by:
Hiya, i made a asp page, and one of my divs (as a include) is as below. the problem is if the main page is resubmitted, i get logged out again?... heres the code.. i think its on the value=true...
3
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I want to limit the user only login the system one time at the same time. I don't want him login the system two with the same user at the same time. How to do this? If i have a table to record...
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.