Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Cannot load local file in Firefox unless a URL was previously loaded #3997

Closed
lukeis opened this issue Mar 3, 2016 · 4 comments
Closed

Cannot load local file in Firefox unless a URL was previously loaded #3997

lukeis opened this issue Mar 3, 2016 · 4 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 3997

To recreate the problem, do this:

#Create an instance of a Firefox webdriver
from selenium.webdriver.firefox import webdriver
wd = webdriver.WebDriver()

#Create a local html file located at path
open.(path, 'w').write(html)

#Load the file with the webdriver
wd.get(path)

This produces the following error:

wd.get(path)
  File "/usr/local/lib/python2.7/dist-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/remote/webdriver.py",
line 165, in get
    self.execute(Command.GET, {'url': url})
  File "/usr/local/lib/python2.7/dist-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/remote/webdriver.py",
line 153, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium-2.21.3-py2.7.egg/selenium/webdriver/remote/errorhandler.py",
line 147, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'Component returned failure
code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]'

If, however, a URL is loaded with wd.get(url), I CAN load a local file.

Selenium version: 2.21.3
OS: Ubuntu
Browser: Firefox
Browser version: 12

Reported by AWNystrom on 2012-05-31 09:04:04

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Also, my Ubuntu version is 11.04, and my python version is 2.7.1.

Reported by AWNystrom on 2012-05-31 09:39:45

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

You'll need to prefix the file path with a the file:// scheme for Firefox to understand
it.

Reported by jari.bakken on 2012-05-31 20:45:11

  • Status changed: WorkingAsIntended

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Thank you, and sorry to bother you!

Reported by AWNystrom on 2012-05-31 21:55:59

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:15:32

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant