Forum Discussion

aa1's avatar
aa1
Contributor
2 years ago

Automation script in ReadyAPI for Authentication

Hi, I am new to Ready API. I am trying to authenticate the user credentials and set it up as the script inside Auth Manager so that we can run the ready API test suites from the pipeline automatically. Manual set up for authentication is working fine and we are able to call the APIs and get results. We use Oauth2.0 authentication. The automation script that I have is not working. I am not sure what I am missing.

This is what I tried referring to this document:  https://support.smartbear.com/readyapi/docs/requests/auth/types/oauth2/automate/index.html

var loginForm = document.querySelectorAll(".ab.cd");
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var loginBtnForm = document.querySelector(".c2");
var loginBtn = document.querySelectorAll(".c3.c4.c5.c6.c7");

document.getElementById("username").value = "testusername";
document.getElementById("password").value = "testpassword";

loginBtn.click();