Unable to navigate through script

Hi Respected Members,
I am having some issues with running a workflow using the script.
I am working with a react application & here is the workflow I am trying to achieve.
I am running wpt private instance.

Launch Application - Navigate

Click Login Button to navigate to the login page - execAndWait document.querySelector(‘.selector’).click()

Enter cred & click the login button -
exec document.querySelector(‘.username’).value=“username”
exec document.querySelector(‘.password’).value=“password”
execAndWait document.querySelector(‘.submit’).click()

upon successful login click on logout - execAndWait document.querySelector('.logout’).click()

I am unable to click the submit button[on page 2] when I m running the above script, but the same works if I directly navigate to that login page & execute the commands.
i.e. the below works fine
Navigate /login
exec document.querySelector(‘.username’).value=“username”
exec document.querySelector(‘.password’).value=“password”
execAndWait document.querySelector(‘.submit’).click()

Please suggest what I am doing wrong & I want to measure the timings under a single workflow.

Any help would be highly appreciated.