Trying to login to laravel application using Locust. My code is following:
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
self.login()
def login(self):
response = self.client.get("/en/login")
csrftoken = response.cookies['XSRF-TOKEN']
session = response.cookies['bitrent_session']
post_data = {'username': "user@user.com", 'password': '1234', "_token": csrftoken }
with self.client.post('/en/login', post_data,
catch_response=True) as response:
print("Code: ", response.status_code)
print("Content: ", response.content
@task()
def index(self):
self.client.get("/")
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 5000
max_wait = 9000
However I got error - Code 419 Content The page has expired due to inactivity. Could anyone advise me how to login to Laravel application using Locust