Jump to content
Macro Express Forums

Finding a button on a page and clicking it


NeVeR

Recommended Posts

Hi All.

 

I'm making a macro for my website.

 

I need the marco to find a button and click it. The normal way I would do this is find text.. press esc then press Enter.. but the press enter doesn't work on these buttons for some reason.

 

Is there a way to trigger a mouse click on a set bit of text ?

 

I can't do a mouse position then click as I'd need this to work on different screen sizes.

 

I actually need this to happen twice.

 

Once on the same button text which is "Join game" and then again on something different every time ( I will have this macro on repeat and each time it will be picking something different from a set T3 tag )

 

so tips would be great.

Thanks.

Link to comment
Share on other sites

Try spacebar instead of Enter.

 

Buttons generated via JavaScript may not be keyboard accessible. Ditto for HTML buttons that are improperly coded. Have you validated the code?

 

A valid HTML button that has keyboard focus is activated by pressing Enter. If this doesn't work, fix the code on your website.

Link to comment
Share on other sites

Hi,

 

Sorry for the late reply.

 

The code is valid. The buttons are made using CSS.

 

I tried the spacebar and it doesn't work either.

 

Here's something I tested.

 

When i search for the word.. and press ESC on it.. Enter doesn't work ( or spacebar ) .. but if i press TAB.. and then enter/spacebar it does work. But by press tab i'm moving to the next button .. which is not what I want to do.... I should note that all the buttons are using the same CSS.

 

is it possible in Macro express to move the mouse to a bit of text ?

 

That way I could move it to the text and issue a mouse click command.

Link to comment
Share on other sites

What I do is to search for some text in front of the button, type TAB to get focus to the button and then do the ENTER.

 

Are you searching for the text of the button or text of something in front of the button?

 

I'm searching the text on the button. i can't search for something before it as it changes all the time. I need to click the text on the button.

Link to comment
Share on other sites

 

 

When i search for the word.. and press ESC on it.. Enter doesn't work ( or spacebar ) .. but if i press TAB.. and then enter/spacebar it does work. But by press tab i'm moving to the next button .. which is not what I want to do.... I should note that all the buttons are using the same CSS.

 

If you are able to reach the target by searching for a word, pressing Esc, pressing Tab (which moves focus to the next element), then Shift + Tab (which moves focus back to the target), and then Enter.... you have found a solution. It's not elegant, but it's a solution nonetheless.

Link to comment
Share on other sites

Sometimes it is most reliable to find text nearby the target, and then either Tab or Shift+Tab to the target. In this example, the target is three tabs before the "Country" field. You might want to do this if the text associated with the target itself is not searchable (e.g., an image) or is ambiguous (e.g., there is more than one field with exactly the same label.)

// Navigate to a button that is three controls "before" the Country field
//
Text Type: <CONTROL>f // Initiate search
Delay: 100 ms
//
Text Type: Country // We will search for the "Country" field...
Delay: 100 ms
//
Text Type: <ENTER> // Do the search
Delay: 100 ms
//
Text Type: <ESC> // Cancel search, which gives focus to the found text
Delay: 100 ms
//
Text Type: <SHIFT><TAB><SHIFT><TAB><SHIFT><TAB> // Back-tab three times...
Delay: 100 ms
//
Text Type: <ENTER> // We arrive at the button. Activate it.
Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...