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
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] }
open about:config
then change security.fileuri.strict_origin_policy
to false
. enjoy
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
I had the same issue. Just solved it. Here is how:
Worked for me on FF 26 and Selenium 2.5
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
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
I faced the same problem. I'm using Ubuntu and apache, but on Windows you can do the same.
/var/www/html
(localhost points per default to this folder) 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.
User contributions licensed under CC BY-SA 3.0