2

I'm using IEDriver to test my webapp. My test is written in Java and driver is defined as following:

System.setProperty("webdriver.ie.driver","C:\\Selenium\\IE\\IEDriverServer.exe");
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
driver = new InternetExplorerDriver(capabilities);
driver.manage().window().maximize();

I'm facing the problem when the tests simulates F5 after form submission with:

Actions actions = new Actions(driver);
actions.keyDown(Keys.CONTROL).sendKeys(Keys.F5).perform();

As a result appears IE window saying: enter image description here

I've tried to skip it by performing

actions.keyDown(Keys.CONTROL).sendKeys(Keys.ENTER).perform();

and

driver.switchTo().alert().accept();  

As I've understood, this window is not an alert, so driver can not switch to it. So is there any way to execute "Retry" in this window?

Vignesh Paramasivam
  • 2,360
  • 5
  • 26
  • 57
andriy
  • 4,074
  • 9
  • 44
  • 71

2 Answers2

1

Java Robot utility can be used to click on the Retry button. Sample code is written below:

Robot robot = new Robot();
robot.keyPress(java.awt.event.KeyEvent.VK_ENTER);
robot.keyRelease(java.awt.event.KeyEvent.VK_ENTER);

Hope it helps!

Sitam Jana
  • 3,123
  • 2
  • 21
  • 40
0

If you use F5, then the page will refresh items which are modified, considers cache, so you will get warning.

Instead try reloading the entire page something like,

driver.navigate().refresh();

This will load the page without any warning. This post will give you some insights.

Look for Diff b/w F5 and navigate().refresh()

Community
  • 1
  • 1
Vignesh Paramasivam
  • 2,360
  • 5
  • 26
  • 57
  • Thank you for your answer, but in my tests I have 2 possibilities. Test with `driver.navigate().refresh();` and with F5 too – andriy Aug 13 '14 at 13:08