0

I have a question, I want to upload a file in a popup window that is open in my web application.

  1. I can not inspect the element of the popup window, window that is opened (F12 not response in this window)

  2. I try this solutions that not worked

    WebDriver deiver2 = getWebDriver();
             Thread.sleep(8000);
             Alert alert = deiver2.switchTo().alert();
             alert.sendKeys("yyyyy"); 
    

the second attemp is:

WebDriver deiver2 = getWebDriver();
        Thread.sleep(8000);
        deiver2.switchTo()
                .activeElement()
        .sendKeys(
                "yyyyy");
        System.out.println("END");

In the first attempt it says that no alert exists. In the second attempt it passed but I do not see it feel value in the text field (still blank), How I can upload a file in selenium via popup. (and how to inspect the path field to locate the element in the new popup?)

this is the popup screen. enter image description here

Bastian
  • 1,089
  • 7
  • 25
  • 74

1 Answers1

0

this is what solved it

deiver2.switchTo()
                .activeElement();
        System.out.println("Window title: "+ deiver2.getTitle());

        deiver2.findElement(By.xpath("//input[@type='file']"))
        .sendKeys(
                "X:\\AutomationFiles\\yyyyy.pdf");
Bastian
  • 1,089
  • 7
  • 25
  • 74