Automating Web Application

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
cgaston
Junior Coder
Posts: 24
Joined: Sat Jan 22, 2005 11:52 am
Location: Ottawa, Canada

Automating Web Application

Post by cgaston » Mon Feb 07, 2005 7:40 pm

I realize that automating a web application could be quite different than for a regular Windows application. Is there somewhere a "Getting Started" document that can assist me for my first Web application on our Intranet?

Alternatively, I can read through the Tips forum, but that might not be the most efficient way to acquire the technical skills required for Web Apps.

Thank you,

Gaston

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Feb 07, 2005 7:59 pm

Take a look at the script snippet here:
http://www.mjtnet.com/forum/viewtopic.php?t=1390

This script provides all the functions you need to automate web applications.
MJT Net Support
[email protected]

cgaston
Junior Coder
Posts: 24
Joined: Sat Jan 22, 2005 11:52 am
Location: Ottawa, Canada

Post by cgaston » Tue Feb 08, 2005 1:13 am

Well, I am not sure that I have everything I need.

Using your code, I can launch IE, and connect to my Intranet home page. But, once there, there is like a menu row. When the cursor passes over one of the menu option, a drop down sub-menu get displayed. I then need to click one of the sub-menu option. And that gets me to another page... where the action continue...

In your example, the "frame" parameter is null. I suspect, that I might have to specifiy a frame parameter. But, how could I determine it? I am not a web programmer.

To clarify my problem, I can send you screen shots of my Intranet pages, as well as the related source code. Is there a way in this forum to attach documents? If not, can I eMail them to you at [email protected]?

Thank you,

Gaston.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 08, 2005 7:30 am

You can leave the frame parameter blank if automating the main frame. You only need this if automating a sub frame.

Navigating a web app or web page is a simple case of navigating to a new URL or filling in form fields and submitting forms. So that script gives you two functions - Navigate - where you specify the new URL, and FormFill where you specify a form field name, the value to set it to and whether or not to submit the form. These two functions are all you need to navigate around the web or a web application.

Figuring out what info you need to supply for the form fill function is usually a case of looking at the source of the page.

You might be interested in RapidFIRE! which includes a web macro recorder which will create all the code for you. You just record the session and it will build the script. It is designed for web applications like yours. For further info see: http://www.theiconsortium.com/content/view/18/47/ or email [email protected]
MJT Net Support
[email protected]

cgaston
Junior Coder
Posts: 24
Joined: Sat Jan 22, 2005 11:52 am
Location: Ottawa, Canada

Post by cgaston » Fri Feb 25, 2005 3:37 pm

I am afraid that it may not be that simple.

The web application that I am trying to automate is controlled by a username/password on the main page. Access to the other pages must be done through a structure of menu/submenu on that main page.

For security reason, direct access to the other pages is disallowed by the application.

Using MSched, I can login to the first page successfully. When I try to "navigate" to any other pages, I get an error message from the application that I cannot access that page directly.

I am feelig as if I am into a dead-end.

Any suggestions?

Thank you,

Gaston.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Feb 25, 2005 3:52 pm

I have sent you a private message with a link to a tool which might help you create your script.
MJT Net Support
[email protected]

cgaston
Junior Coder
Posts: 24
Joined: Sat Jan 22, 2005 11:52 am
Location: Ottawa, Canada

Post by cgaston » Fri Feb 25, 2005 5:50 pm

Unfortunately, that did not help.

The recorder produce the following code fragment:

...
VBRun>Navigate,%IE[0]%,,http://hm-intranet/
Wait>delay
VBRun>Navigate,%IE[0]%,,http://hm-intranet/BDGestion.aspx
Wait>delay
VBRun>FormFill,%IE[0]%,,-----------------------------7d533c364901e6
Content-Disposition: form-data; name,"__VIEWSTATE"
...

hm_Intranet is the main page. As the system "remember" by username and password, I do not have to enter them. That page gets displayed successfully.

The other page (hm-intranet/BDGestion.aspx) produce the same error message.

Gaston.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Feb 25, 2005 7:03 pm

The other page (hm-intranet/BDGestion.aspx) produce the same error message.
Same error message as what? What was the error message?
MJT Net Support
[email protected]

cgaston
Junior Coder
Posts: 24
Joined: Sat Jan 22, 2005 11:52 am
Location: Ottawa, Canada

Post by cgaston » Fri Feb 25, 2005 7:08 pm

"That page cannot be accessed directly".

Note that this is not an IE message. This message originates from the application.

Gaston.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Feb 25, 2005 7:14 pm

The application must be able to detect that the navigate is being caused by a script. The referrer should be ok, because you are at the correct page first, so this must be script detection or something. Quite interesting.

Therefore the only solution would be to get to that page by simulating user input. The only way you're going to be able to automate the navigation to that page is by sending a key press or key click on the link that gets you there.

You can TAB from link to link. Work out how many TABS you need to get to the required link once you've arrived at the page and then press ENTER to initiate the link:

SetFocus>Internet Explorer*
Press TAB * x
Press Enter

That will simulate a user clicking the link. That will work but is less reliable and doesn't take into account the page being modified.
MJT Net Support
[email protected]

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Feb 25, 2005 7:16 pm

Oh, and if you first need to fill the form you can use FormFill but don't set the last number to 1 - the last parameter means 1 for submit, 0 for don't submit. So fill the form using the FormFill function but change 1 to 0 so that it doesn't submit, then try the submit by simulating user input.
MJT Net Support
[email protected]

cgaston
Junior Coder
Posts: 24
Joined: Sat Jan 22, 2005 11:52 am
Location: Ottawa, Canada

Post by cgaston » Fri Feb 25, 2005 11:42 pm

When I TAB through the form, different objects get selected consecutively. However, the cursor never gets into the Menu area, at the top of the screen.

The menu gets activated just by moving the mouse over it. I can then move down to the sub-menu option I want, and click it. I do not know how to achieve this through the keyboard.

Gaston.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts