Python Forum
unable to lunch firefox using python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unable to lunch firefox using python
#1
WebDriverException: Message: connection refused

while using geckodriver for firefox,unable to load the web page,any suggestion for this issue
Reply
#2
You should publish some code.
Then we could help better.
Reply
#3
from selenium import webdriver
import time
browser = webdriver.Firefox(executable_path = 'C:/OracleExtraMonitor/geckodriver.exe')
browser.get('https://www.google.com')

#browser = browser.get('firefox').open('https://www.google.com')
time.sleep(3)
browser.quit()
Reply
#4
Look here for setup.
Can test again to make sure it work as,see the there extra step eg caps["marionette"] = True.
Can be False if using older FireFox browser.
Keep all update.
pip install -U selenium
FireFox ver 67.0
geckodriver-v0.24.0
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.keys import Keys
import time

#--| Setup
options = Options()
#options.add_argument("--headless")
caps = webdriver.DesiredCapabilities().FIREFOX
caps["marionette"] = True
browser = webdriver.Firefox(options=options, capabilities=caps, executable_path=r"geckodriver.exe")
#--| Parse or automation
browser.get('https://duckduckgo.com')
input_field = browser.find_elements_by_css_selector('#search_form_input_homepage')
input_field[0].send_keys(f'car{Keys.RETURN}')
time.sleep(3)
images_link = browser.find_elements_by_link_text('Images') # Name Images in your country
images_link[0].click()
time.sleep(5)
browser.quit()
So this work fine for me,also it open FireFox search for car and show images of cars.

I have to use this as it switch languages Bilder(Norway) == Images
browser.find_elements_by_link_text('Bilder')
Reply
#5
Traceback (most recent call last):
File "C:\OracleExtraMonitor\testff2.py", line 33, in <module>
driver = webdriver.Firefox(executable_path='C:\\Kesko\\Python27\\Lib\\geckodriver.exe')
File "C:\Kesko\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 152, in __init__
keep_alive=True)
File "C:\Kesko\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 98, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Kesko\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 188, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Kesko\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 256, in execute
self.error_handler.check_response(response)
File "C:\Kesko\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: connection refused
Reply
#6
Use python 3.7.
Python 3.6/3.7 and pip installation under Windows
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  The python DOT org cert problem and a new Firefox Skaperen 12 7,037 Nov-19-2017, 02:42 PM
Last Post: metulburr
  Peek preview of Firefox's WebRender Larz60+ 0 2,699 Oct-12-2017, 07:00 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020