I am in the process of creating some BDD tests using Java, Cucumber & Selenium.
The problem I am having is the website I am attempting to test has been specifically designed to work with firefox and I have been asked to test it only on this browser. When I navigate to the page, firefox creates a popup asking for permission to store data on the computer for offline use. (See picture below)
I am struggling to get selenium to recognise this alert and accept it.
So far I have attempted and failed at the following:
- I have attempted to access the popup by attempting to access the window alert – this hasn’t worked and I had a null pointer.
- I have also attempted capturing the preferences of the Firefox profile on my personal machine (after allowing the website to store information) and copy them into a profile within the selenium code. This also hasn’t worked.
I have also attempted creating an empty profile with just this preference set:
firefoxProfile.setPreference("network.online", false);
The problem is the web page will not load any of its data till you accept this message. So any code I have created that tests the site always fails.
Has anyone else ever come across this issue before and if so how did you solve the problem?
I am using Selenium-Server 2.53.0 on windows 7 with java 7