1
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

class PythonOrgSearch(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Firefox()

    def test_search_in_python_org(self):
        driver = self.driver
        driver.get("http://www.python.org")
        self.assertIn("Python", driver.title)
        elem = driver.find_element_by_name("q")
        elem.send_keys("pycon")
        elem.send_keys(Keys.RETURN)
        assert "No results found." not in driver.page_source


    def tearDown(self):
        self.driver.close()

if __name__ == "__main__":
    unittest.main()

""" ERROR: "The browser appears to have exited" WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details."""

When I run this code I get this error.

ERROR: test_search_in_python_org (main.PythonOrgSearch)

Traceback (most recent call last): File "example.py", line 8, in setUp self.driver = webdriver.Firefox() File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 80, in init self.binary, timeout) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 52, in init self.binary.launch_browser(self.profile, timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 68, in launch_browser self._wait_until_connectable(timeout=timeout) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 99, in _wait_until_connectable "The browser appears to have exited " WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.

  • Explain your problem a way better than you did now. Don't forget to show a line where you exactly get your error. – Denis Koreyba Sep 06 '16 at 12:43
  • You need to download gecko driver, and use marianette with latest firefox follow this link http://stackoverflow.com/questions/38676719/fail-to-launch-mozilla-with-selenium and see python stuff to resolve this issue.. – Saurabh Gaur Sep 06 '16 at 12:43

0 Answers0