5

I need to test a feature of my app designed to execute in offline mode, using local storage to queue data before internet connectivity is restored. Can Selenium set browser in offline mode?

1 Answer 1

1

You can create the new Browser Profile say for firefox. and then configure that profile to use offline mode using :

network.manage-offline-status with the value true.

Sign up to request clarification or add additional context in comments.

3 Comments

Can I set the profile dynamically? I want to simulate a scenario where the app loses connectivity during usage.
No. Profiles are set at the beginning only. You could try other non-selenium tricks to lose connection, however (if you are going to run selenium remotely, that won't work).
If you try this, you will get the following exception: java.lang.IllegalArgumentException: Preference network.manage-offline-status may not be overridden: frozen value=false, requested value=true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.