Click a Link

I'm spending way too much time on this. So I'm taking the suggestion from previous interactions and just asking for help.
I simply need to have a macro click on the SIGN IN button on a webpage to sign into my YouTube account (in Opera, but ideally, any browser).
I think the button (or whatever it is) has a lot of dynamic text in it, but the beginning seems like it's probably the same:
https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passive=true&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Den%26next%3Dhttps%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253DgLPqxm14LE0&hl=en&ec=65620

The button or link says SIGN IN and looks like this:

I've looked and looked at the results of many searches in the forum and wiki with no success, hence my request for help. Thanks.

The Click at Found Image action (in the Interface Control category) is the usual solution to this.

and I think, in principle, you should also be able to click by an identifier like an XPath

HTML element clicked by XPath.kmmacros (2.8 KB)

1 Like

That works for me in Safari and Google Chrome on macOS Mojave (10.14.6).

I don't seem to be having any luck using QuerySelector though...

That doesn't work (tried in Opera using Front Browser and Safari using Click Safari Link). It "failed to find link" in the browser window.

I'll likely need some hand holding to pursue that idea.

Yep, I have used that approach but was hoping KM could actually figure out where the link is and be able to click on it. If nothing else works, I'll go with this approach. (I'm actually patting myself on the back a little because I know enough KM to do this. :no_mouth: )

You have to turn on Allow JavaScript from Apple Events for the browser actions to work properly.

In Safari that's in the Develop menu.

In Google Chrome it's in View > Developer > Allow...

In Vivaldi that setting is in the Privacy Settings of the App. (I've refused to monkey with Opera, since it was sold.)

Allowing JavaScript from Apple Events has no effect. Still does not work.

Hmm, this worked. Yesterday, I was just using the last step as a test with Safari in the front, which didn't work. But I downloaded your .kmmacros file, tried it as is, and it worked. So, I guess I did something wrong and there's something magical in your macro steps that makes it work. I'll mark as solved even though I don't understand. Thanks.