MacOS – How to automate the wifi login of a captive window

automatormacos

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

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?

Best Answer

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.