A few questions that would help us diagnose:
- Is the error message inside a HTTP response or displayed in the console?
- Is the POST request to wp-login.php the very first request in the script?
- Are you seeing this error with just a single VU (in other words, does it always fail)?
A “connection refused” message generally suggests that a server is there but nothing is accepting connections on whichever port your HTTP requests are headed for (usually 80 or 443).
When I’ve seen this in the past (where you are able to record in the browser but not replay), it is most often due to the presence of a web/filtering/corporate proxy that your browser may be configured to use (fairly common on Windows AD-controlled domains). It could be that k6 isn’t aware of system-level proxy settings, which could explain why it isn’t able to reach out when the browser can. I’ll try to get confirmation on what our default behavior is.
In the meantime, if the site is publicly-accessible, I’d be happy to try a record and replay from my system which isn’t behind any proxies (message me the URL if you’d like to keep it private), just to rule that out.