• Register
0 votes
204 views

Problem :

I am trying to develop some selenium tests which should run with headless firefox but the following error suddenly popped up in my server.log file when I was trying to connect to the webdriver via following command:

driver = webdriver.Firefox(firefox_profile = profile, log_path = logfile)

Please find below the error:

1518520162032   geckodriver::marionette INFO    Starting browser /usr/bin/firefox with args ["-marionette"]

Failed to connect to Mir: Failed to connect to server socket: No such file or directory

Unable to init server: Could not connect: Connection refused

Error: cannot open display: :1137

I have not done any changes in my code. It was working fine before this error came. How can I fix the above error???

My software spec as below:

python 2.7.12, Firefox: Mozilla Firefox 57.0.3, geckodriver: 0.19.1, selenium: 3.8.0

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

Your error is giving all required information:

Failed to connect to Mir: Failed to connect to server socket: No such file or directory

Unable to init server: Could not connect: Connection refused

Error: cannot open display: :1137

This error indicates that your DISPLAY property was not set properly.

Please add the below configuration in the .bashrc :

export DISPLAY=:0

For the Gnome on Ubuntu 16.04, the correct value should be DISPLAY=:1 (and not DISPLAY=:0)

The problem must be happening due to env_keep variable from /etc/sudoers. So the permanent solution should be adding the below line at the end of  /etc/sudoers by using gedit or using sudo visudo as follows:

Defaults env_keep+="DISPLAY"

 After above changes your issue will be resolved.

9 7 4
38,600 points

Related questions

0 votes
1 answer 14 views
14 views
I am trying to build a shared library using a C extension file but first I have to generate the output file using the command below: gcc -Wall utilsmodule.c -o Utilc After executing the command, I get this error message: > utilsmodule.c:1:20: fatal error: ... solutions over the internet but the problem still exists. I have no problem with Python.h. I managed to locate the file on my machine.
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 100 views
100 views
I'm getting something like this. Can anyone please tell me how to fix this. C:\Users\krush\Documents\ML using Python>pip install pocketsphinx Collecting pocketsphinx Using cached pocketsphinx-0.1.3.zip Building wheels for collected packages: pocketsphinx Running setup.py bdist_wheel for pocketsphinx: started ... ------------------------- Command "C:\Users\krush\Anaconda3\python.exe -u -c "impor
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 11 views
11 views
I keep on recieving this error in my php project “failed to open stream: no such file or directory” each time I need to include a php file. What is the best practice to include another php file from a different folder? Is it also possible to include a php file located in a different domain?
asked Oct 12, 2020 azriel 590 points
0 votes
1 answer 6 views
2 votes
1 answer 2.5K views
2.5K views
Problem: When I try to run the below command on my command prompt: python get-pip.py It shows the following message: C:\Users\ASUS>python get-pip.py python: can't open file 'get-pip.py': [Errno 2] No such file or directory How can I have pip installed in my system. Then why am I getting this error message and why I can not open this file. Thanks in advance.
asked May 6, 2020 samhaz 5k points
0 votes
1 answer 1.4K views
1.4K views
I was creating a new project in django. Firstly I installed django in my system but when I run the command : python manage.py runserver It does not work It shows a message : python: can't open file 'manage.py': [Errno 2] No such file or directory ... django and I started a project by running the command : django-admin startproject Utility Why am I seeing this error message, do anyone know?
asked Mar 18, 2020 LizzyM 6.1k points
0 votes
1 answer 2.4K views
2.4K views
Problem : Following is my issue: I tried to install mysqlclient like below : C:\Users\alecxe>pip install mysqlclient Collecting mysqlclient Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1 cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz Installed ... beginner to this and would be very happy if any input as to how to go about fixing above error.
asked Dec 27, 2019 alecxe 7.5k points
0 votes
1 answer 1.8K views
1.8K views
Problem : The import matplotlib.pyplot as plt is is giving me the error with python2.7, anaconda3. The error shown is as below: ImportError: libGL.so.1: cannot open shared object file: No such file or directory The Detailed Error report is as below : Traceback ... <module> from PyQt5 import QtCore, QtGui, QtWidgets ImportError: libGL.so.1: cannot open shared object file: No such file or directory
asked Dec 18, 2019 alecxe 7.5k points
0 votes
1 answer 752 views
752 views
Problem : While trying to import the OpenCV, using import cv2 I facing the below error: /usr/local/lib/python2.7/dist-packages/cv2/__init__.py in <module>() 12 13 # make IDE's (PyCharm) autocompletion happy ----> 14 from .cv2 import * 15 16 # wildcard import ... - I am trying to play around with the Google's new Colaboratory tool. Please let me know if someone have solution for the above issue.
asked Dec 18, 2019 alecxe 7.5k points