Click on a specific button

Hello,

I have a snippet where I want to automatically click a submit button after entering the text. I have solved this in such a way that I first execute the Tab key for this and then a left mouse click. So far, this has also worked perfectly.

Now, however, the web page has changed and another button occasionally appears before the submit button. This then causes the wrong button to be clicked. Is there a way to specify a specific Submit-button to click for this case? Unfortunately, I can no longer work with the tab key in this case.

Hi @Kamuro Welcome back to the forum! :slight_smile:

Unfortunately there is no way to click on specific elements. We may add this functionality down the road. Just to confirm, the specific Submit button is not reachable via keyboard actions? such as Shift-Tab, Tab, etc.? If you can give me more details about the website, I can also check this myself.

See also:

No, the Button is not reachable via keyboard actions. Here is a screenshot:

Thanks for letting me know. I'll keep you posted if we develop any related feature.

As a quick test, can you tell me which website this is so I can also double check this on my end? Maybe I can suggest you some workaround.

Sorry, but the site is only accessible to team members but not to the public.

I would also love to be able to select a specific button. In my case, I want to click a button, but the button can be in a different place sometimes (just like @Kamuro). I use the "if,elseif,else" commands to use different amounts of "shift tabs" in different cases. If this website changes its interface, I have to change all my snippets as well. It would be a lot easier to be able to select the button without the key presses. @Gaurang_Tandon has anything changed in the recent updates?
@Kamuro Maybe you can also use the if/else commands :blush:

This is my snippet:

snippet here{if: contains({site: url}, "reply")}{note}this does nothing{endnote}{elseif: contains({site: path}, "facebook")}{repeat: 5}{key: shift-tab}{endrepeat}{key: enter}choose sentiment{key: downarrow}{key: enter}second tag {key: downarrow}{key: enter}{else}{repeat: 4}{key: shift-tab}{endrepeat}{key: enter}choose sentiment{key: downarrow}{key: enter}second tag{key: downarrow}{key: enter}{endif}

Hey @Monica_Scholte Thanks for explaining your use case in detail :smiley:

In your case, you mentioned the site interface/layout changes, so the order of the buttons has changed.

Is the site selector also different for all the buttons? If it is the same, then Placer, a companion function to Selector would be useful for you as well.

If the site selector is not the same, then what is the relation between the buttons? Do they all look the same visually?

It seems you are using this snippet on Facebook. Can you tell which Facebook buttons you are referring to? It would be helpful to understand this better.

1 Like

Thanks for the quick reply @Gaurang_Tandon :blush:

We work with Sprout Social, which collects all reactions on all channels into one inbox. In other words: our Facebook, Instagram, Tiktok and Youtube replies are all collected into one "feed".

The order of the buttons does not change, there's just more/less selectable buttons depending on the channel. As you can see in my snippet, I need 5 shift tabs for Facebook and 4 for the other channels. Furthermore, the snippet "ignores" Facebook threads (which is the first part of the "if" command, with the note "this does nothing").

This is what the button looks like (circled in red). The selectable parts are highlighted in yellow:

By "site selector" do you mean the button or something else?

By the way, I will be on holiday for 1,5 weeks after today, but happy to pick up where we left off with this topic when I'm back :blush:

Ah, I see.

Try this:

  1. add the "Website" command with "contents HTML" selected into your snippet.
  2. use the "Select from website" button to generate to select your target button in the first layout.
  3. now, run the snippet and check the output that you got.
  4. now, change the layout (so the number of shift-tabs changes), and run the snippet again.

If you get the same HTML output on running the snippet again, that means the site selector is consistently selecting the same button on every rerun. Let me know if it works for you.

Thank you! I will check back after my holiday, must say that this is quite advanced for me already. Please tell me:

  • Where should the command be, does that matter? Can you tell me what my snippet should look like?
  • What should I do in step 2 exactly?
  • What do you mean by layout? Do I need to change the snippet to test this, or change the situation (so: reply to FB comment first, check the output, then do the same for a different comment that needs less shift-tabs)?

Thanks in advance :blush:

Let's connect over email to check this, after you are back. Happy holidays! :partying_face:

1 Like

@Andrew_Hall this is what I was talking about :blush:

Hello @Gaurang_Tandon,

thank you for your help. Unfortunately, I haven't quite understood this yet either. So I ran the "site selector" and identified the button on the page. The result was then a {site: html; selector=.button-send}.

How does it go on then? I pasted the code into the snippet and then gets an HTML code that produces the send-button when using the snippet.

Hi @Kamuro , my post was a not a suggestion, but just a discussion about adding a new command potentially. That command, would click on the button using its selector (like the one you have - .button-send). See this post for more discussion on this topic: Placer, a companion function to Selector

Unfortunately, however, the {placefocus: selector=.button-send} statement does not work. This is only entered as HTML text, but the button is not selected.

Yes, that is correct, because I have not implemented the command yet (I might do soon down the line). I'll keep you posted when I do implement it.

Ok, I understand. Thank you very much. This would be very helpful.

@Gaurang_Tandon Have you found time to address this issue yet?

Hi @Kamuro sadly not yet. As this is a big change, it will likely take some time to be implemented. Thanks for your patience!

3 Likes

Bookmarked and following for, hopefully, an eventual solution as well. My work is done on an internal webpage and automating a couple of forms would be amazing, but not unless I can click some buttons that are not reachable through key clicks (tab, shift-tab) at various points in the automation.

4 Likes