3

enter image description hereThrough first URL, I click on login (as shown in Image) which leads to another URL where I need to enter the credentials. But before that page I see a pop up generated from the browser which cannot be located by Selenium. enter image description here. The version of my chrome browser is Version 61.0.3163.100 (Official Build) (64-bit)

I tried using the following methods:

  1. Alert.dismiss()

  2. JavaScript

    ((JavascriptExecutor) driver).executeScript("window.confirm = function(msg) { return
    

    true; }");

  3. AutoIt

    WinWaitActive("Windows Security")
    Send("admin{TAB}")
    Send("Password{Enter}")
    
  4. Robot class

    alert.sendKeys("UserName");
    Robot robot = new Robot();
    robot.keyPress(KeyEvent.VK_TAB);
    robot.keyRelease(KeyEvent.VK_TAB);
    alert.sendKeys("Password");
    alert.accept();
    
  5. Also tried to navigate through second URL by entering the Username and Password within the URL

Along with this also used some of the Chrome options in my selenium script

ChromeOptions options = new ChromeOptions(); 
options.addArguments("--disable-popup-blocking");
options.addArguments("chrome.switches","--disable-extensions");
driver = new ChromeDriver(options); 


ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("disable-popup-blocking");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(capabilities); 


WebDriverWait wait = new WebDriverWait(driver, 10);      
Alert alert = wait.until(ExpectedConditions.alertIsPresent());     
alert.authenticateUsing(new UserAndPassword(username, password)); 

Is there any other way to remove this popup within chrome settings or through script?

Thanks in Advance

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
rijojoshua
  • 31
  • 1
  • 3
  • What error message you are getting? And which language you are working on? AutoIt should have resolved your problem. WinWaitActive("Windows Security") Send("admin") Send("{TAB}") Send("Password") Send("{ENTER}") – Shoaib Akhtar Oct 12 '17 at 06:28
  • Possible duplicate of [Selenium - Other way to basic authenticate than via url](https://stackoverflow.com/questions/45345882/selenium-other-way-to-basic-authenticate-than-via-url) – undetected Selenium Oct 12 '17 at 06:33
  • @ShoaibAkhtar : I'm not getting any error. I'm working in JAVA. All my scripts get passed in Firefox (except for some functionality which is supported by Chrome) My Actual problem is on My second screen I'm getting an authentication popup in chrome browser which I need to Cancel Manually to continue with other part of the script – rijojoshua Oct 13 '17 at 05:37
  • @DebanjanB : I tried that configuration also. It didn't serve the purpose – rijojoshua Oct 13 '17 at 05:40

1 Answers1

0

Following code working for me

    Robot robot;
    try {
        robot = new Robot();
        robot.keyPress(KeyEvent.VK_ENTER);
        robot.keyRelease(KeyEvent.VK_ENTER);
    } catch (AWTException e) {
        e.printStackTrace();
    }
Liu
  • 1