Python Forum
unable to lunch firefox using python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: unable to lunch firefox using python (/thread-18728.html)



unable to lunch firefox using python - sanjay - May-29-2019

WebDriverException: Message: connection refused

while using geckodriver for firefox,unable to load the web page,any suggestion for this issue


RE: unable to lunch firefox using python - heiner55 - May-29-2019

You should publish some code.
Then we could help better.


RE: unable to lunch firefox using python - sanjay - May-29-2019

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()



RE: unable to lunch firefox using python - snippsat - May-29-2019

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')


Connection not able to establish between Firefox and geckodriver in python - sanjay - May-30-2019

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


RE: unable to lunch firefox using python - snippsat - May-30-2019

Use python 3.7.
Python 3.6/3.7 and pip installation under Windows