How to move mouse and click using KM

I usually have multiple WordPress tabs open in Chrome, and I need to click the option 'EDIT POST', then click the next tab and repeat the process. Doing this manually is tedious. How can I accomplish this with KM, assuming the location of the EDIT POST is the same each time, but the tab must be moved to the adjacent one when the macro (script?) is run. The EDIT POST resides in a toolbar at the top of the screen, only visible when the WordPress owner is logged in and viewing one of the published articles.

Sounds easy enough. But I would have to make several guesses without more information. I don't have an account on that site and to be honest I'm not eager to make one. Can you make a video of your screen while you do this editing? That would be helpful, because, as they say, a picture is worth 1000 words. Curiously, I just posted a solution for someone else today that would carry some of the same elements that your solution requires. Check out my code on this page. If you wish, you can also try to modify the code in the following link to click on the EDIT POST button rather than to check if the page contains an Apple URL.

I made a burner account on WordPress to whip this up, and I think I ended up with a different UI than you, so this may take some editing.

Click "Edit" button on all WordPress tabs.kmmacros (4.6 KB)

Macro image

This macro starts on your current tab and proceeds to all tabs to the right of it. It finds the button by looking for class="actnbr-btn actnbr-edit" , which may be different for you if it turns out we're on different pages.

You can right click on your "EDIT POST" button and click Inspect to find the correct class names in the Elements tab of Developer Tools.

1 Like

Is this the button you're referring to?

If so, give this a shot:

WordPress - Click "Edit" for All Tabs.kmmacros (23 KB)

Macro screenshot

Adjust the green action if you're targeting a different link.


Nice one @noisneil, a much better (more KM-native) design.

1 Like

...IF it works!

1 Like

Thank you all so much for your help! This is the Edit Post link I'm talking about. I haven't tried any of your solutions yet.

Also, I'd like the Browser to be CHROME as opposed to SAFARI:

Does this mean the class name is 'ab-item' ?

Here's a Loom of me doing the process manually: Loom | Free Screen & Video Recording Software | Loom

Here's me doing the process manually:

Install the SelectorsHub extension and use it to grab the Relative Xpath of the Edit Post button. Paste that into the green action.

thanks - how do I update your macro to use Chrome instead of Safari?

My macro references the Front Browser, so will work for Chrome too.

I appreciate you trying to help - I've tried to use SelectorsHub but it's all Greek to me - I can't work out the Relative XPath using it. Have been through their help pages but I'm not technical so can't proceed. Any simpler solution?

it looks like you'd be able to get my example working by changing the querySelector input
from: '.actnbr-btn.actnbr-edit'
to: '#wp-admin-bar-edit'

That said, I still think @noisneil's method is more suitable in the long run.

I'm not sure if you're looking for a different solution or not. I posted a link for you above to a different approach. I can't tell if you tried my approach. Did you?

Once the extension is installed, all you do is right-click on the button and select SelectorsHub > Copy Relative Xpath. Then paste that into the green action.

Thanks for your help.

//a[normalize-space()='Edit Post']

So I've added it in as shown below.

Assuming this is correct, how do I run the script?

Any reason you changed the condition in the Exit at Final Tab group to contains? Change it back to is =.

To run it, just press the hotkey shown in the trigger section at the top.

Unfortunately, pressing the hot key with the browser open does nothing whatsoever.

Is the macro enabled in its group?

yep, it has the tick