Firstly, this is maybe be a smell that your application is not built with a testability mindset.
In the Automation environment:
1 - This feature should be removed;
or
2 - The user should be automatically loggedlog by sending a token generated unicallyuniquely by the application, identifying therefore the user.
There are ways of working around the issue, but this way you would still have an application difficult to test and probably your tests would take longer to run.
Attack the disease, not the symptoms.