Selenium IDE - local (non-webhosted) file access for testing?


My Problem

When Selenium IDE is used to run a test, the "Base URL" is always accessed via http on some web server.

I need to know if (and how) its possible to get Selenium IDE to run a test on a locally stored file. When opening a file in Firefox, the path looks something like this in the Address Bar: file:///C:/Documents and Settings/username/My Documents/somehtml.html

However, Selenium gives a nasty error when I put this path in the Selenium IDE's Base URL field for my test (See bottom of my post).

What I tried

I run Windows XP and have tried switching the file path slashes to backslashes while keeping the protocol (file:///) slashes as is. I tried replacing spaces with %20 too.

I also considered whether my Firefox proxy settings might be causing an issue, but it isn't because if i open the file in Firefox it does so without issue.

The solution I'm working on is to avoid Selenium WebDriver at this phase. I know it is better on a technical but there are practical reasons why I can't use that at this point. Selenium IDE must be used for now.


Error thrown when attempting to open local file:

[error] Unexpected Exception: name -> NS_ERROR_FAILURE, QueryInterface -> function QueryInterface() { [native code] }, message -> Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href], result -> 2147500037, filename -> chrome://selenium-ide/content/selenium-core/scripts/selenium-browserbot.js, lineNumber -> 686, columnNumber -> 0, location -> JS frame :: chrome://selenium-ide/content/selenium-core/scripts/selenium-browserbot.js :: BrowserBot.prototype.setOpenLocation :: line 686, inner -> null, data -> null, initialize -> function initialize() { [native code] }

asked on Stack Overflow Apr 25, 2013 by Manus Du Plessis • edited Apr 26, 2013 by jimpanzer

6 Answers


open about:config then change security.fileuri.strict_origin_policy to false. enjoy

answered on Stack Overflow Oct 28, 2013 by Sigmo • edited Apr 16, 2014 by xyz

One solution is to use the open command as the first line in your test, and set the local path as the target. This is fine for a handful of tests, but may not be sufficient for larger test suites.

command: open
target: file///c:/path/to/your/file.html
answered on Stack Overflow Apr 26, 2013 by lukeocom

I had the same issue. Just solved it. Here is how:

  1. Remove the base url.
  2. Enter open or openWindow in command
  3. Enter the file url in target e.g. file:///C:/temp/junk/SomeSiteAutomation/ABC.htm

Worked for me on FF 26 and Selenium 2.5

answered on Stack Overflow Jun 12, 2014 by codester

Open Selenium IDE - chrome extension As soon as we open it will ask for project name and project url - just cancel it Go to selenium IDE

enter image description here

In selenium IDE - in "command" text box select "open" in "target" text box enter the path to sample html file as below "file:///D:/index2.html" Then this will show up in the command, target and value columns of the selenium ide. Now just run the test. This will open up the local html file

answered on Stack Overflow Jan 13, 2019 by Seetaram Hegde

I faced the same problem. I'm using Ubuntu and apache, but on Windows you can do the same.

  1. move your index.html to /var/www/html (localhost points per default to this folder)
  2. use as base_url in selenium ide
answered on Stack Overflow Nov 22, 2019 by Nursultan Imanov

Right click on the Selenium IDE icon in the upper right of the browser window. Select "Manage Extensions" from the context menu. Toggle on "Allow access to file URLs" in the settings dialog.

This works in Chrome/Windows 10 and Version 3.17.0 of Selenium IDE.

answered on Stack Overflow Apr 14, 2020 by Andrew Cowenhoven

User contributions licensed under CC BY-SA 3.0