Sign in to follow this  
Followers 0
saldous

Mouse click on a button on a web page

9 posts in this topic

#1 ·  Posted (edited)

Hi, I have a script that opens a webpage where there is a logon box. My script can complete the email address and password fields on the web page but when I have the script submit the form the webpage comes back to the login page, I think the website doesn't want to allow this to happen.

So to get around it I'm wanting to have my script complete the fields, but instead of submitting the form I want the mouse to go to the login button and click it. Can this be done? The problem is users will have different screen resolutions so I don't think I can give the mouse coordinates, it needs to locate the login button first and then click it, but I don't know how to do this. Any ideas? Thanks. (PS. I also tried using the Send("{ENTER}") but that had the same problem.

Edited by saldous

Share this post


Link to post
Share on other sites



Well, if screen resolution is your problem:

If @DesktopHeight = XXXX AND @DesktopWidth = XXXX Then MouseClick(...)

However, I don't think that using the MouseClick command is good, perhaps try another method of obtaining your preferred results.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

I can't think of another way :-(

I'm having a problem with the WinGetPos, I was trying to use this to locate some text on the web page, then from those co-ordinates do the mouse click, but the WinGetPos always returns the same co-ordinates, and they are not locating the text in the web page.

Share this post


Link to post
Share on other sites

WinGetText? IE functions? Not sure.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

I don't think WinGetText is right, it won't give me the co-ordinates of where that text is on the page. Thanks for trying to help though, I'll keep thinking!

Share this post


Link to post
Share on other sites

Screenshot of the webpage or something?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Screenshot attached. I want to be able to click the "Log On" Button.

My problem seems to be related to what the help file says about the IEFormSubmit function:

For many HTML forms it is not sufficient to use _IEFormSubmit() because there is often custom Javascript tied to an onclick event for its Submit button. In these cases you'll need to simulate a click of the submit button instead of using _IEFormSubmit(). See the example for the "click" action of _IEAction().

post-20839-1172449743_thumb.jpg

Edited by saldous

Share this post


Link to post
Share on other sites

I'd just use a pixel search to simulate a click on it

$login = PixelSearch(0, 0, 1000, 1000, 0x6 digit hex color, 0, 10

If Not @error then

mouseclick('left', $login[0], $login[1], 1, 0)

EndIf

Share this post


Link to post
Share on other sites

Now that is one perfect solution, it works a treat. Thank you Jasio. :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0