Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   How to click a button programatically? (http://www.go4expert.com/forums/click-button-programatically-t15602/)

noamjob 25Dec2008 17:34

How to click a button programatically?
 
Here is what I need to do:
Let's say I want to make a program that perform a search by First Name in a site like this(only for demonstration, I'm not spamming...):

search in google for <draftexpress search> and you'll get an example

Let's say I want to search for "james".

How do I do it? I spent many hours on this and couldn't find out...
The main problem iis that the website is not mine, so how can I access its components?(Let's say I want to "click" the search button there programatically)?
Is there a way to do it?
I would appreciate if you expain in details, I'm preety much new in that area...

thanks,
Noam

shabbir 25Dec2008 17:40

Re: How to click a button programatically?
 
The best way is to use the url.

http://www.google.com/search?q=go4expert

It would lead you to the result of go4expert

noamjob 25Dec2008 18:23

Re: How to click a button programatically?
 
What???
I think you didn't understand my problem.
I don't want to perform a search in google. I want to perform a search within a website. I tried to put the hyperlink to the website ao you could see my problem but the forum here doesn't let me do it, so instead I instruct how to find the website I'm talking about: By searching in Google for
draftexpress search
and going to the first result there.
You would see what I'm talking about: there is an option to search players by their first name. In order to do so, you fill the name in the box("james" for example) and then click the "search" button. After you click it, you get directed to a new link with the results - but the new link's name doesn't contain anything like "james"... So I figured out the only way to make my program go to the new page is to make the program actually fill in "james", click the "search" button and then somehow get to the new page with the results. THE PROBLEM is I don't have any clue how to do it...

Thanks again...

shabbir 25Dec2008 20:56

Re: How to click a button programatically?
 
Yes I know why you are not allowed to place link to site but I am also not suggesting the Google Search but there are 2 ways a form is submitted

GET and POST

If they support Get you can use the direct URLs

Else if they don't then you would need to get form and use the same code for the button click and get a response.

This means you create a page on your site which can be made to click and then when clicked it gets a results from that site into some frame and then do accordingly.

Bhullarz 18Jan2009 04:50

Re: How to click a button programatically?
 
yeah . Just chk the behaviour of the website like when you search anything, is the url contains the keyword "you have used" then the simple way is to generate querystring. Otherwise open the webpage's source code and find the form action and then create your own page use the same action page with same variables which were used in original page.
For the querystring you have to study the URL passed after search. If still problem is there. copy paste the URL here in the board. We will see how can we help you.

skp819 31Jan2009 11:41

Re: How to click a button programatically?
 
install firebug.
right-click on or next to button and select "inspect element"
find the html tag of the button. it is probably a <input type="button"> tag.
look for an onclick attrib on the tag, and copy the value of the attribute.
click the console tab of firebug and pase the code into the console.
click run, and the result should be the same as clicking the button.


if there is no onclick attrib, it's a little trickier.
you need an id for the input.
if it has one, great.
if not, while inspecting the input, right click the tag and select "new attribute", type "id" press enter and type "test1" and press enter.

click back on the console tab and type in $("test1").onclick.toString()

the code you need to run will appear in red text. copy it and paste it into a function, or run it from the console to simulate a click.


All times are GMT +5.5. The time now is 03:03.