Source language: Translate to:

Browser setElement

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Browser setElement

Postby Luke » Wed Oct 04, 2006 7:32 am

BrowserSetElement "WebBrowser1" "youremail" "luke@yahoo.com"
BrowserSetElement "WebBrowser1" "yourpassword" "lukespass"


Next I want to simulate pressing The " login" button on the webbrowser ...

How can i do it ?
Luke
 
Posts: 30
Joined: Thu Nov 17, 2005 6:24 am

Postby Neosoft Support » Wed Oct 04, 2006 10:42 am

Try this:

Code: Select all
BrowserExecScript "WebBrowser1" "document.getElementById([#34]ButtonName[#34]).click()" "JavaScript"


Replace "ButtonName" with the name of the button you want to click.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Gaev » Wed Oct 04, 2006 11:02 am

Luke:

If your form has an "Id" e.g ....
Code: Select all
<form id="myForm" etc. etc. ....>
... then you can send the following via BrowserExecScript ...
Code: Select all
document.getElementById("myForm").submit()

This was previously discussed here ... http://www.neosoftware.com/forum/viewto ... orm+submit
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Neosoft Support » Tue Jan 26, 2010 2:46 pm

In order for BrowserSetElement to work, you need to know something about how the HTML page was constructed. They are all different. For example, given the following HTML content:

Code: Select all
<form name="mainform">
  <p><font face="Arial">First Name: <input NAME="FirstName" value="" size="20"></font></p>
  <p><font face="Arial">Last Name: <input NAME="LastName" value="" size="20"></font></p>
  <p><font face="Arial"><BUTTON NAME="B1" onclick="SetVars()">Send Data to NeoBook</button><br>
  <small>Click this button to send information to NeoBook.</small></font></p>
  <p><font face="Arial"><BUTTON NAME="B2" onclick="GetVars()">Get Data from NeoBook</button><br>
  <small>Click this button to retrieve information from NeoBook.</small></font></p>
</form>


...the following NeoBook script will set the values of the FirstName and LastName text fields:

Code: Select all
BrowserSetElement "WebBrowser1" "FirstName" "Joe"
BrowserSetElement "WebBrowser1" "LastName" "Smith"


If the names assigned to the text fields are different, then the NeoBook script would need to be changed to reflect that or it won't work.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Neosoft Support » Fri Jan 29, 2010 11:53 am

What website are you trying to access - your own or someone else's?

as i understood this way to access websites that work in post method not get method ,, is that right?


NeoBook includes InternetGet and InternetPost actions, but these are entirely different from the BrowserSetElement action being discussed here.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Gaev » Sat Jan 30, 2010 9:05 am

Abdullah:

What is the URL of the webpage that (normally) presents a Login facility to you when you use a Browser (like Internet Explorer) ?

InternetGet and InternetPost are not the way to go for what you have described above as your requirement.

Instead, you will need to have a WebBrowser object ... and pass it the URL ... and then populate the User/Password Boxes from NeoBook ... this step is unique to each situation as there are many ways to code the html/javascript for this ... and a lot of web sites go to great lengths to thwart such automatic logins (from hackers, spammers etc.) ... including the use of the CAPTCHA image (where humans can decipher wobbly text in an image but computers can't) ... finally, you have to simulate the submit button of the login facility.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby dpayer » Sun Jan 31, 2010 12:05 pm

Abdullah wrote:Hi Neosoft

i have a website that i have an account on it

i want to send my username and password to it and show my account homepage using neobook

tried internetpost/get action in the past with no luck , the website uses post method ..

good luck


There can be issues. At times, a page sets cookies with certain variables and include them in the submit process. Also, you have to be very clear what name the SITE gives for the form and use that, it must be specific and if it is a Linux server, it may be case sensitive as well.

It may be easier for you to display the page in NB and then to a series of simulated keystrokes to enter the data and click the submit/login button.

David P
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 3 guests