Login, fill in forms, logout

Discussion in 'Javascript' started by Barry Margolin, Feb 19, 2004.

  1. 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,
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
     
    Barry Margolin, Feb 19, 2004
    #1
    1. Advertising

  2. Barry Margolin <> 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 -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Feb 19, 2004
    #2
    1. Advertising

  3. In article <>,
    Lasse Reichstein Nielsen <> wrote:

    > Barry Margolin <> 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,
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
     
    Barry Margolin, Feb 19, 2004
    #3
  4. Barry Margolin <> 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 -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Feb 19, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Henry

    Forms Login/Logout

    Brian Henry, Jul 3, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,213
    swati254
    Jun 4, 2008
  2. =?Utf-8?B?dmE=?=

    RE: Logout status doesn't really logout?

    =?Utf-8?B?dmE=?=, Mar 26, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    585
    =?Utf-8?B?dmE=?=
    Mar 26, 2006
  3. =?Utf-8?B?RFdT?=

    RE: Logout status doesn't really logout?

    =?Utf-8?B?RFdT?=, Mar 26, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    581
    =?Utf-8?B?RFdT?=
    Mar 26, 2006
  4. =?Utf-8?B?dmE=?=

    Logout status doesn't really logout?

    =?Utf-8?B?dmE=?=, Mar 26, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    693
    =?Utf-8?B?dmE=?=
    Mar 26, 2006
  5. Toni Pohl
    Replies:
    1
    Views:
    951
    Toni Pohl
    Aug 10, 2008
Loading...

Share This Page