I want to automate filling out a wifi captive portal page on macos because I am not asked to save the password.

But only the username gets recorded not the password. The click on the password field gets recorded but not the input.

How can I determine if this is a limitation in Automator or the captive window or the design of the web page when it programmed how the text entry fields are set up?

How can I get the source code of the page from the captive window?

  • I've made an pretty big edit here to change this from a a yes / no question to something more likely to get a good answer. If you want to edit in your script or the browser you use or what macOS version - someone might have another way to automate this if that's something they know will work – bmike Jun 12 at 11:25
  • 1
    Is filling in the login part of a larger script? Because otherwise, I can't see what Automator gives you that just using MacOS's built-in user and password fill-in doesn't. – benwiggy Jun 12 at 13:13

Deliberately Restricted

Yes, this is a deliberate choice by Apple's engineers. Automator – and other applications – can not intercept keystrokes sent to password fields.

The restriction is enforced by macOS. The keystrokes sent to secure text fields do not appear in the read-only copy of events sent to other observing processes.

Browsers Using Native Controls

Within a web browser that uses native macOS controls, HTML password fields are represented by a NSSecureTextField.

NSSecureTextField deliberately restricts what can see or record its input. The field also limits copying and cutting of the contents.

Other Approaches

See How I created a Python Bot to automatically log into a Captive Portal or search for script wifi login form for other related projects and tools.

  • So - the web designer identifies the field and the web browser / Automator pick up on that classification and decline to enter a value in that field? I'm guessing the proper answer is to use a password manager or store the password in the keychain and get it securely, but maybe that's not what's being asked. – bmike Jun 12 at 11:26
  • I would by-pass the browser and send the credentials via the curl tool – the WiFi login page will most likely be expecting a form response, which curl can handle. – Graham Miln Jun 12 at 11:49
  • @bmike its not website or browser but a wifi captive window like this one – zanony Jun 12 at 13:06
  • @GrahamMiln, but I can not access the login webpage (ip address shown in the captive window) from a browser because I am not connected yet. – zanony Jun 12 at 13:12
  • 2
    @GrahamMiln thanks I got the login page and could use safari to save the credentials. Maybe I just bookmark the login page and run with that :) – zanony Jun 12 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .