I am trying to simulate a logged in user activity for stress testing a WordPress site using this script:
import http from "k6/http";
import { sleep } from "k6";
export default function() {
var url = "http://example.com.com/wp-login.php";
var payload = JSON.stringify({ user_login: "admin", user_pass: "adminpass" });
var params = { headers: { "Content-Type": "application/json" } }
http.post(url, payload, params);
console.log(payload);
http.get("http://example.com/wp-admin/post-new.php")
sleep(1)
};
This doesn't work and I am redirected to the login page. What am I doing wrong?