Download a file in IE using Selenium

后端 未结 6 1425
忘掉有多难
忘掉有多难 2020-12-06 08:35

OK, so I am trying to export a file using Selenium. My browser is IE. When I click on the export button a native windows dialogue box comes up.

Image of the pop up

6条回答
  •  [愿得一人]
    2020-12-06 09:04

    I had the same problem. I came to realization that

    button.click()
    

    does not work very well in this case (with IE driver). So instead of clicking the button I tried this:

    robot = new Robot();
    button.sendKeys("""");
    robot.keyPress(KeyEvent.VK_ENTER);
    robot.keyRelease(KeyEvent.VK_ENTER);
    

    This just gives focus on button and 'presses' it by hitting enter.

提交回复
热议问题