Okta Login Cannot Find Username

Setting up a synthetics test using scriptedbrowser to login to my site which uses Okta for authentication. However, the scripted browser seems unable to render the page causing a timeout when trying to find the username field:

.then(function() {
  return $browser.waitForAndFindElement($driver.By.id('okta-signin-username')).then(function(usernameElem){
        return usernameElem.sendKeys('myusername');

The error is a timeout on finding the okta-signin-username element. The accompanying screenshot is blank. I have tried using the default user-agent and setting the current chrome version useragent, no change, always times out.

Has anyone else successfully browser scripted for Okta login here?

@keith19 Sorry you have been waiting awhile for a response from our community. I’m going to bring this back to the attention of our support team. Thanks for your patience!

Neal Mc

Hi there @keith19

Thanks for your patience. First, I want to make sure you have the relevant documentation that may be helpful here:

You are on the right track in using the scripted Browser Monitor.

Handling multi-factor authentication might be a challenge, as it helps protect against scripted logins in its design, by requiring the additional factor. A key element to this is being able to interface with the other factor being used for verification from your monitor script.

From a Synthetics monitor we can make HTTP requests to external endpoints, so if there is a service that exposes access to a factor by an HTTP API, this might be a path to explore. Factors that use an iOS and Android application, SMS notifications on a mobile device, or physical OTP/key devices present a challenge, but again it is also what makes them effective factors.

Other options you could explore are if there is a way to provision a minimum rights user account that is not fronted with MFA for monitoring, or a way to provide a HTTP header token to bypass the MFA.

Lastly, if you can set Okta to one factor authentication, this would make the job much easier!

Please let me know if this does not get you pointed in the right direction.

The problem isn’t multi-factor. The problem is the login page doesn’t appear to render at all.

Would you be able to provide a link to the Monitor you are having issues with? The one thing I do notice from the snippet you provided is the domain doesn’t look correct, but not sure if that’s identical in the script:

https://mysitecom/login —> https://mysite.com/login

Could you check if that’s the case? :slight_smile: