automate web browsing

Forums for specific tips, techniques and example code
ascribe
Posts: 16
Joined: Mon Sep 14, 2009 1:51 pm
Location: Australia
Contact:

automate web browsing

Postby ascribe » Wed Oct 14, 2009 5:22 pm

Hi

Is there a way to automatically from a Jade application to bring up the web brower with google webpage for example, fill out the text box then click the Goolge Seach button?

I can display the page in default web browser by using command call _shellExecute (0, "open", "http://www.google.com", 0, 0, 1); but don't know how to automate the rest.

Any help much appreciated

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: automate web browsing

Postby allistar » Wed Oct 14, 2009 10:26 pm

For Google the format of a query is:

http://www.google.co.nz/search?hl=en&rl ... meta=lr%3D

That is for the query "query text here"

ascribe
Posts: 16
Joined: Mon Sep 14, 2009 1:51 pm
Location: Australia
Contact:

Re: automate web browsing

Postby ascribe » Thu Oct 15, 2009 10:18 am

Thanks, but I forgot to mention I want to use Post request or something similar. Because it will be used for logging in a web service I don't want query text in this case user name and password to be displayed in the URL.

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: automate web browsing

Postby BeeJay » Thu Oct 15, 2009 4:25 pm

If you have CardSchema in your system, you could utilise the CnHttp class to help do HTTP POST messages to a Web Page.

This is the technique that I used when converting the old Newsgroup postings onto these new forums, including logging onto the forums as the ConvertFromOldNGs user before being able to post the new messages etc.

Cheers,
BeeJay.

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: automate web browsing

Postby allistar » Fri Oct 16, 2009 9:51 am

From what I understand of the original query, the requirement is for a web browser to be opened, fields filled in and then a button on the page clicked. If you are in control of the web server (i.e. you can add a new file to it), then you could make a new page (in php or asp or whatever scripting language is installed) and pass that any relevant parameters using shell execute, and have that simulate the POST using javascript. That'll only work though if you can put this new file on the web server.

ascribe
Posts: 16
Joined: Mon Sep 14, 2009 1:51 pm
Location: Australia
Contact:

Re: automate web browsing

Postby ascribe » Fri Oct 16, 2009 11:19 am

Thanks guys, I'll give both methods a go

torrie
Posts: 92
Joined: Fri Aug 14, 2009 11:24 am

Re: automate web browsing

Postby torrie » Mon Oct 19, 2009 9:48 am

You could also try importing the Web Browser active X control and use the methods available to open the relevant web page etc. (Note that this uses Internet Explorer not the user's preferred browser) see http://msdn.microsoft.com/en-us/library ... S.85).aspx for the details of methods etc that are available.

ascribe
Posts: 16
Joined: Mon Sep 14, 2009 1:51 pm
Location: Australia
Contact:

Re: automate web browsing

Postby ascribe » Tue Oct 20, 2009 1:09 pm

You could also try importing the Web Browser active X control and use the methods available to open the relevant web page etc. (Note that this uses Internet Explorer not the user's preferred browser) see http://msdn.microsoft.com/en-us/library ... S.85).aspx for the details of methods etc that are available.
Do you know any activeX or Com can do such thing and also support cross browser?

torrie
Posts: 92
Joined: Fri Aug 14, 2009 11:24 am

Re: automate web browsing

Postby torrie » Tue Oct 20, 2009 1:37 pm

I'm not aware of an active X that will work across different browsers. However there is an active X control that has been developed for Firefox which has the same methods etc as the Microsoft Web Browser cotrol. http://www.iol.ie/~locka/mozilla/control.htm. I haven't used it so couldn't comment on how it would work.

We use the Web Browser control embedded into a Jade form to display HTML pages that we generate from our application and users are not aware that IE is being used.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 10 guests

cron