1

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?

ED209
  • 588
  • 1
  • 9
  • 26
  • Hope you made sure that the page got loaded and indexedDB was available before you try to delete them. Its not like, you try to delete a db that doesn't exist and then it gets created. – Ahamed Abdul Rahman Jun 25 '23 at 04:51

0 Answers0