0

I am trying to automate gmail authentication in the selenium tests. I am using javascript for the automation. And I am using the following code to automate the process.

let driver = await new Builder().forBrowser("chrome").build();
await driver.get("http://localhost:3000");
const emailAuth = await driver.findElement(
      By.xpath(
        "/html/body/div[1]/div/div/div[2]/div/div[1]/form/ul/li[1]/button"
      )
;
const parentWindow = await driver.getAllWindowHandles();
await emailAuth.click();
const allWindowHandles = await driver.getAllWindowHandles();
var childWindow = allWindowHandles[0];
if (allWindowHandles[1] !== parentWindow) {
  childWindow = allWindowHandles[1];
}
driver.switchTo().window(childWindow);
let emailAddress = await driver.wait(
until.elementLocated(By.id("identifierId")),
      10000
    );
await emailAddress.sendKeys("xyz@gmail.com");
await emailAddress.sendKeys(Key.RETURN);

After sending the RETURN key to the email address. I get the message "could not sign in. Chrome is being controlled by automated software".Please check the attached image. And automated tests can not log in. How to fix this issue?enter image description here.

user1927603
  • 373
  • 2
  • 8

0 Answers0