-1

I am using selenium to crawl a javascript website, the issue is that, a Firefox browser opens up, but the call for the URL is not done. however, when I close the browser, it is then that call for URL is done and of course I get the missing driver exception. what do you think the issue comes from.

knowing that:

  • all programs are up-to-date
  • my solution works fine, in local, but when I try to deploy it on the server, I start having issues

Example: at my local machine, I run this script and everything goes smooth, however when I run it a server (Linux), only the browser opens up and no get URL is called

from selenium import webdriver
import time

geckodriver_path = r'.../geckodriver'

driver = webdriver.Firefox(executable_path= geckodriver_path)
time.sleep(3)
driver.get("http://www.stackoverflow.com")
4
  • 1
    please add your exception log. Commented May 10, 2018 at 11:04
  • the exception is not important because it is me who generate it when i close the browser: selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 0 Commented May 10, 2018 at 11:18
  • my question is more about why the browser remains open without passing the part where the call for url will be done Commented May 10, 2018 at 11:19
  • Please include a minimal reproducible example that illustrates the problem. Commented May 10, 2018 at 12:24

1 Answer 1

0

I end up finding the solution :

from selenium import webdriver
import time
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

geckodriver_path = r'/path_to/geckodriver'

binary = FirefoxBinary(r'/usr/bin/firefox')

capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities["marionette"] = False

driver = webdriver.Firefox(firefox_binary=binary,
                           executable_path= geckodriver_path,
                           capabilities=capabilities)

time.sleep(3)
driver.get("https://stackoverflow.com/")
time.sleep(6)
driver.close()

# solution from: 
# https://github.com/SeleniumHQ/selenium/issues/3884
# https://stackoverflow.com/questions/25713824/setting-path-to-firefox-binary-on-windows-with-selenium-webdriver
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.