0

I'm a beginner python user and try to use selenium to open Firefox on Win 10 and Anaconda 2.5. I just downloaded Firefox and installed selenium on Anaconda, so they are up to date. When I type the following:

from selenium import webdriver
browser = webdriver.Firefox()

Firefox open in the task bar for a second and disappears. But if I close the cmd line, Firefox opens on the window. The cursor on the cmd prompt is flickering so when I wait, then I get the error message. How can I solve this?

Traceback (most recent call last): File "", line 1, in File "C:\Anaconda2\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 59, in init self.binary, timeout), File "C:\Anaconda2\lib\site-packages\selenium\webdriver\firefox\extension_connection.py", line 47, in init self.binary.launch_browser(self.profile) File "C:\Anaconda2\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 61, in launch_browser self._wait_until_connectable() File "C:\Anaconda2\lib\site-packages\selenium\webdriver\firefox\firefox_binary.py", line 105, in _wait_until_connectable self.profile.path, self._get_firefox_output())) selenium.common.exceptions.WebDriverException: Message: 'Can\'t load the profile. Profile Dir: c:\users\kwan\appdata\local\temp\tmplb0d6s Firefox output: 1464547978869\taddons.manager\tDEBUG\tLoaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]\r\n1464547978870\taddons.manager\tDEBUG\tLoaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]\r\n1464547978873\taddons.manager\tDEBUG\tLoaded provider scope for resource://gre/modules/addons/GMPProvider.jsm\r\n1464547978874\taddons.manager\tDEBUG\tLoaded provider scope for resource://gre/modules/addons/PluginProvider.jsm\r\n1464547978875\taddons.manager\tDEBUG\tStarting provider: XPIProvider\r\n1464547978875\taddons.xpi\tDEBUG\tstartup\r\n1464547978876\taddons.xpi\tINFO\tMapping fxdriver@googlecode.com to c:\users\kwan\appdata\local\temp\tmplb0d6s\extensions\fxdriver@googlecode.com\r\n1464547978876\taddons.xpi\tINFO\tSystemAddonInstallLocation directory is missing\r\n1464547978876\taddons.xpi\tINFO\tMapping e10srollout@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi\r\n1464547978876\taddons.xpi\tINFO\tMapping firefox@getpocket.com to C:\Program Files (x86)\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi\r\n1464547978877\taddons.xpi\tINFO\tMapping loop@mozilla.org to C:\Program Files (x86)\Mozilla Firefox\browser\features\loop@mozilla.org.xpi\r\n1464547978878\taddons.xpi\tINFO\tMapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi\r\n1464547978878\taddons.xpi\tDEBUG\tSkipping unavailable install location app-system-share\r\n1464547978878\taddons.xpi\tDEBUG\tSkipping unavailable install location app-system-local\r\n1464547978878\taddons.xpi\tINFO\tMapping web2pdfextension@web2pdf.adobedotcom to C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Browser\WCFirefoxExtn\r\n1464547978879\taddons.xpi\tDEBUG\tcheckForChanges\r\n1464547978879\taddons.xpi\tDEBUG\tLoaded add-on state from prefs: {"app-profile":{"fxdriver@googlecode.com":{"d":"c:\\users\\kwan\\appdata\\local\\temp\\tmplb0d6s\\extensions\\fxdriver@googlecode.com","e":false,"v":"2.40.0","st":1464547977236,"mt":1464547977189}},"app-system-defaults":{"e10srollout@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\e10srollout@mozilla.org.xpi","e":true,"v":"1.0","st":1462246394000},"firefox@getpocket.com":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\firefox@getpocket.com.xpi","e":true,"v":"1.0","st":1462246394000},"loop@mozilla.org":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\loop@mozilla.org.xpi","e":true,"v":"1.2.6","st":1462246394000}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","e":true,"v":"46.0.1","st":1462246394000}},"winreg-app-global":{"web2pdfextension@web2pdf.adobedotcom":{"d":"C:\\Program Files (x86)\\Adobe\\Acrobat 11.0\\Acrobat\\Browser\\WCFirefoxExtn","e":false,"v":"2.0","st":1458012184487,"mt":1348422236000}}}\r\n1464547978880\taddons.xpi\tDEBUG\tExisting add-on fxdriver@googlecode.com in app-profile\r\n1464547978880\taddons.xpi\tDEBUG\tgetModTime: Recursive scan of e10srollout@mozilla.org\r\n1464547978881\taddons.xpi\tDEBUG\tExisting add-on e10srollout@mozilla.org in app-system-defaults\r\n1464547978881\taddons.xpi\tDEBUG\tgetModTime: Recursive scan of firefox@getpocket.com\r\n1464547978881\taddons.xpi\tDEBUG\tExisting add-on firefox@getpocket.com in app-system-defaults\r\n1464547978881\taddons.xpi\tDEBUG\tgetModTime: Recursive scan of loop@mozilla.org\r\n1464547978882\taddons.xpi\tDEBUG\tExisting add-on loop@mozilla.org in app-system-defaults\r\n1464547978882\taddons.xpi\tDEBUG\tgetModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}\r\n1464547978882\taddons.xpi\tDEBUG\tExisting add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global\r\n1464547978882\taddons.xpi\tDEBUG\tExisting add-on web2pdfextension@web2pdf.adobedotcom in winreg-app-global\r\n'

timbre timbre
  • 12,648
  • 10
  • 46
  • 77
Kwan
  • 1
  • 3

2 Answers2

0

Thanks guys who viewed my posts. I figured out the solution. I googled "anaconda selenium install" and there is a hit on top and I followed it. The thing is its command installs Selenium 2.40 but the current version is 2.53. Anaconda does not have Selenium package so "conda install selenium" does not work. BUT you can still use "pip install selenium" and it will install the latest selenium

Kwan
  • 1
  • 3
  • Keep in mind that as soon as you update Firefox, it will fail to start due to this: http://stackoverflow.com/questions/37761668/cant-open-browser-with-selenium-after-firefox-update/37765661#37765661 – Mobrockers Jun 14 '16 at 09:24
0

additionally for conda packages not in the Anaconda channel you can search and install packages other users have added to Anaconda Cloud(Anaconda.org).

conda install anaconda-client
anaconda search selenium

The above will list users that have uploaded the package. Choose one for your operating system and install as follows for any package you search for:

conda install -c <username> <package name>

(Link)

iabraham
  • 3
  • 1
  • 4