473,322 Members | 1,699 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,322 software developers and data experts.

Newbie Alert

Hi:

I am a programmer (but in a language that is compiled into C code --
then onto .obj and and then an executable -- xHarbour)

I already am able to (programmatically) visit websites, and read (using
IE and innerHTML) pages, then parse the textual contents of the page to
glean the info I need. The websites I am visiting use Javascript 1.1

Now, I need to emulate/enter a 'UserName' and 'Password', then produce a
'Click' on the 'Submit' button all within my program.

btw, I have ordered Javascript The Definitive Guide thru Amazon, and
will get delivery within 5 days. In the meantime, do you have any hints on
producing a 'click' on the Submit button.

another btw, I have looked thru the Javascript Guide and haven't got
much further.

Anyway, it turns out that Javascript is very close in syntax to my
xHarbour opensource language (see www.xharbour.org) and I'm anxious to
learn!!

Thanks !

--
Mel Smith
Aug 13 '08 #1
4 1531
On Aug 13, 4:12 am, Mel Smith wrote:
<snip>
I already am able to (programmatically) visit websites,
and read (using IE and innerHTML) pages, then parse the
textual contents of the page to glean the info I need.
So that would be instantiating and externally driving an IE web
browser COM component?
The websites I am visiting use Javascript 1.1
That is improbable. HTML LANGUAGE attributes in SCRIPT elements have
very little use or meaning nowadays.
Now, I need to emulate/enter a 'UserName' and 'Password',
then produce a 'Click' on the 'Submit' button all within my
program.
<snip>
In the meantime, do you have any hints on producing a 'click'
on the Submit button.
IE provides a - click - method on its submit button elements. Calling
that will have the same (theoretically form submitting) consequences
as a user clicking the button with some pointing device, except that -
click -, - focus - and - blur - events will not necessarily occur on
that element. The - submit - event of the containing form will be
triggered.

Calling the click method is going to be something like:-

document.forms['formNameOrIndex'].elements['buttonNameOrIndex'].click();

- where - document - may need to be substituted with whatever form of
property accessor gives you a referece to the document in your IE web
browser component.

See also:-

<URL: http://jibbering.com/faq/faq_notes/form_access.html >
Aug 13 '08 #2
Erwin & Henry:

Thank you both for your guidance !

I'll puzzle over your info today (while golfing), and respond tomorrow.

(btw, it shows javascript 1.1 in the source code of all the pages
provided . Hmmmm ..)

(another btw. Yes, I instantiate IE and use

Thanks again !

-Mel Smith

------- a small part of my proggie is below ----
// a small part of my program is below:

TRY
oIE := GetActiveObject( "InternetExplorer.Application" )
CATCH
TRY
oIE := CreateObject( "InternetExplorer.Application" )
CATCH
Alert( "ERROR ! IExplorer not available. [" + Ole2TxtError()+
"]" )
RETURN
END
END

oIE:Visible := .F.
cWebSite := "http://www.xxxx.org/xxxxxx/zzzzzzzz.aspx?ID="+someid

oIE:Navigate(cWebSite)

while oIE:busy

SecondsSleep(1.00)

ENDDO

// Knowing the username and password (my own) I wish to 'submit'
// the page after entering these input values, then 'click' on
// the submit button

// now carry on parsing and processing
// then 'Loop' and do other stuff

Aug 13 '08 #3
On Aug 13, 3:31 pm, Mel Smith wrote:
<snip>
TRY
oIE := GetActiveObject( "InternetExplorer.Application" )
CATCH
TRY
oIE := CreateObject( "InternetExplorer.Application" )
CATCH
Alert( "ERROR ! IExplorer not available. [" +
Ole2TxtError()+ "]" )
RETURN
END
END

oIE:Visible := .F.

cWebSite := "http://www.xxxx.org/xxxxxx/zzzzzzzz.aspx?ID="+someid

oIE:Navigate(cWebSite)

while oIE:busy

SecondsSleep(1.00)

ENDDO
<snip>

Given that, a recognisable equivalent of your intention using Windows
Scripting Host and written in JScript would be:-

var ieInstance, ieDocument, ieGlobal;
var someid = 'XXXXX';
ieInstance = new ActiveXObject("internetexplorer.application");
if(ieInstance){
ieInstance.resizable = true;
ieInstance.width = 500;
ieInstance.height = 400;
ieInstance.navigate(
"http://www.xxxx.org/xxxxxx/zzzzzzzz.aspx?ID="+someid
);
ieInstance.visible = true;
while(ieInstance.readyState != 4){
WScript.Sleep(100);
}
ieDocument = ieInstance.document;
ieGlobal = ieDocument.parentWindow;

ieDocument.forms['FN'].elements['UN'].value = 'User Name';
ieDocument.forms['FN'].elements['PW'].value = 'password';
ieDocument.forms['FN'].elements['SB'].click();
//or
//ieDocument.forms['FN'].submit();
}

Substituting 'FN'. 'UN', 'PW', and 'SB' for the names of the FORM,
user name field, password field and submit button respectively.
Aug 13 '08 #4
Henry said:
Given that, a recognisable equivalent of your intention using Windows
Scripting Host and written in JScript would be:-

var ieInstance, ieDocument, ieGlobal;
var someid = 'XXXXX';
ieInstance = new ActiveXObject("internetexplorer.application");
if(ieInstance){
ieInstance.resizable = true;
ieInstance.width = 500;
ieInstance.height = 400;
ieInstance.navigate(
"http://www.xxxx.org/xxxxxx/zzzzzzzz.aspx?ID="+someid
);
ieInstance.visible = true;
while(ieInstance.readyState != 4){
WScript.Sleep(100);
}
ieDocument = ieInstance.document;
ieGlobal = ieDocument.parentWindow;

ieDocument.forms['FN'].elements['UN'].value = 'User Name';
ieDocument.forms['FN'].elements['PW'].value = 'password';
ieDocument.forms['FN'].elements['SB'].click();
//or
//ieDocument.forms['FN'].submit();
}

Substituting 'FN'. 'UN', 'PW', and 'SB' for the names of the FORM,
user name field, password field and submit button respectively.
Henry:

I'll give that a try tomorrow.

-Mel Smith
Aug 13 '08 #5

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

Similar topics

9
by: Justin Koivisto | last post by:
Is there a way to create an alert-like message box that uses a custom image? Basically, I want to replace the default ! image with something else. -- Justin Koivisto - spam@koivi.com PHP...
21
by: Blue Ocean | last post by:
The reason why I ask is because I am unfamiliar with the idea of templates. It seems like it would be easier if all classes that needed something like template<class T> class Stack { ... } ...
8
by: simon | last post by:
hello. hopefully another quick newbie question for you.... I have a codebehind function coded to handle the click event of a button. what this function does is insert values from a data grid...
1
by: bluer | last post by:
hi, i'm a newbie in java. I'm trying to trace a program in java and thought of using alert inside window.location, I would like to check what the si.getIdea_id_no() value is within the...
1
by: finco | last post by:
Hi all - can someone please point me in the right direction. I have pages that launch their javascript components fine if the page is loaded on its own. But when the page is loaded AJAX the...
3
by: Harlett O'Dowd | last post by:
Please forgive this newbie question but java is new to me and I'm still trying to find a course in my area. I'm tweaking an online survey and have gotten it to display what I want but can't...
5
by: Randall | last post by:
I am a newbie trying to learn the DOM. Can someone tell me why the first alert statement returns null, and the second returns the value 33px (which was set using the style="top:33px;" in the DIV...
4
by: senditontome | last post by:
Hi, As a relative Newbie, I'd appreciate a little assistance with an A2003 DB I'm trying to enhance. This DB handles reports made by security staff on a shift by shift basis based on two...
5
by: Jivanmukta | last post by:
Hello, I am learning JavaScript and I have a question concerning constants in JavaScript: Why JSLint (http://www.jslint.com/) reports error on the following code: const reEmail =...
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...
0
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...
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: 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....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.