I have created a Java selenium automated test suite that tests a progressive web app. I want to delete the browser IndexDB in one of my tests. To do this I planned to create a 'JavascriptExecutor' onject in my Java Selenium test class. This is my code:-
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("window.indexedDB.deleteDatabase('test-db')");
When I run my test the browsers indexedDB is not deleted. There are no errors are thrown in the console either. I have tried running the following command manually in the browser console to make sure that the command works, and it does delete the indexedDB:-
window.indexedDB.deleteDatabase('test-db')
What am I doing wrong?