It is not the javascipt alert. It cannot be handled using Selenium Alert. It is a native os related window similar like file upload window.
In Java, we can use Robot class to simulate keyevent to handle this.
If it is windows os , we can use AutoIt script to handle the pop up. Please refer this related post for auto it usage. This is an exe and can be execute in any language.
I have tried in java using Robot class and it is working for me.
import io.github.bonigarcia.wdm.ChromeDriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.io.IOException;
public class InstallChromeExtention {
public static void main(String[] args) throws IOException, AWTException, InterruptedException {
ChromeDriverManager.getInstance().setup();
WebDriver driver = new ChromeDriver();
driver.get("https://chrome.google.com/webstore/detail/google-keep-chrome-extens/lpcaedmchfhocbbapmcbpinfpgnhiddi");
WebDriverWait wait = new WebDriverWait(driver, 60);
WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[aria-label='Add to Chrome']")));
element.click();
Thread.sleep(5000);
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_TAB);
Thread.sleep(500);
robot.keyPress(KeyEvent.VK_ENTER);
Thread.sleep(500);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[aria-label='Remove from Chrome']")));
}
}