I am using Robot class to bypass basic auth in my local driver; however, the same is not working on LambdaTest. How to fix this?

I am using Robot class to bypass basic auth in my local driver; however, the same is not working on LambdaTest. How to fix this ?

Hi Matthew,

The Robot class does not work as expected in the case of remote browsers. As an alternative to that, we do have keyboard events that can be used to bypass the basic authentication popup.

Please find the code snippet as follows:

driver.executeScript("lambda-set-clipboard:admin");     //username goes here
driver.get("https://the-internet.herokuapp.com/basic_auth");   //URL             
Thread.sleep(2000);
driver.executeScript("lambda-perform-keyboard-events:^v");
Thread.sleep(2000);
driver.executeScript("lambda-perform-keyboard-events:{TAB}");
Thread.sleep(2000);
driver.executeScript("lambda-set-clipboard:admin");         //password goes here
Thread.sleep(2000);   
driver.executeScript("lambda-perform-keyboard-events:^v");
Thread.sleep(2000);
driver.executeScript("lambda-perform-keyboard-events:{ENTER}");

In the above code, we are using the website: https://the-internet.herokuapp.com/basic_auth where the values for both username and password are admin.