Error when using Selenium and Firefox - "invalid argument: can't kill an exited process"

2,969 views
Skip to first unread message

Ryan Farrell

unread,
Jan 7, 2020, 4:28:50 AM1/7/20
to Selenium Users
I am making a twitter bot using geckodriver, selenium and python. I have installed the latest version of all of these but I am receiving this error when I execute the program:


Screenshot from 2020-01-07 18-45-00.png

Nothing i do solves the problem. This is the code. I am running Ubuntu 19.04, and the webdriver is in the right place (usr/bin):

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

class TwitterBot:
def __init__(self, email, password):
self.email = email
self.password = password
self.bot = webdriver.Firefox()

def login(self):
bot = self.bot
time.sleep(10)
email = bot.find_element_by_name('session[username_or_email]')
password = bot.find_element_by_name('session[password]')
email.clear()
password.clear()
email.send_keys(self.email)
password.send_keys(self.password)
password.send_keys(Keys.RETURN)
time.sleep()

ryan = TwitterBot('ryan007...@gmail.com', 'testtest123')
ryan.login()

Joe Ward

unread,
Jan 7, 2020, 7:46:52 AM1/7/20
to seleniu...@googlegroups.com
Have you specified where the program can find Geckodriver? You're not doing it in the above code but it has to happen somewhere, e.g. your path. The error you're receiving suggests it's not even starting. 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/72e542fa-cc42-48cd-8e60-296f37eedc72%40googlegroups.com.

Ryan Farrell

unread,
Jan 7, 2020, 11:57:10 PM1/7/20
to seleniu...@googlegroups.com
How do I specify the path?

You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ibIWEdLvpK4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAJPyTs0J2WKoub6tN4MiTXuNtXArUm9c6xJzPTbcMfTqVh_P3w%40mail.gmail.com.

Joe Ward

unread,
Jan 8, 2020, 1:58:11 AM1/8/20
to seleniu...@googlegroups.com
For reference, this result was the first result on Google when I typed “python driver path”.

Ryan Farrell

unread,
Jan 8, 2020, 2:58:03 AM1/8/20
to seleniu...@googlegroups.com
Ok, I found that page as well, but it just doesn't work for me unfortunately. Geckodriver is in the same file as python, which is in /usr/bin/ yet when I specify the path as demonstrated on the link you sent, it tells me that apparently there is no file or directory. Because apparently the usr directory doesn't exist, but it does, and I don't know what to do. I tried this
image.png
and I got this message 
image.png
It is also irrelevant whether or not I add the '/' at the start of the path, it still doesn't change the message.

Ryan Farrell

unread,
Jan 8, 2020, 3:20:35 AM1/8/20
to seleniu...@googlegroups.com
So, I managed to do a bit more searching and figured out I needed "executable_path=" before my path, however, I did that and now the same problem as I had originally is back. This message:
image.png

ReGenesis CHC

unread,
May 3, 2020, 9:52:43 AM5/3/20
to Selenium Users
Have you found any solution?

Ryan Farrell

unread,
May 4, 2020, 5:42:06 AM5/4/20
to seleniu...@googlegroups.com
lol, its literally been 4 months. yeah, I found one eventually

On Mon, May 4, 2020 at 1:52 AM ReGenesis CHC <mahan...@gmail.com> wrote:
Have you found any solution?


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ibIWEdLvpK4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

Huy Dang

unread,
Jun 4, 2020, 12:57:29 PM6/4/20
to Selenium Users
Hi Ryan, may I ask how you resolve the issue? I have the same error and it has been driving me crazy for the last 2 days. Thank you in advance!


On Monday, May 4, 2020 at 11:42:06 AM UTC+2, Ryan Farrell wrote:
lol, its literally been 4 months. yeah, I found one eventually

On Mon, May 4, 2020 at 1:52 AM ReGenesis CHC <mahan...@gmail.com> wrote:
Have you found any solution?

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ibIWEdLvpK4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to seleniu...@googlegroups.com.

Rishi Dhanaraj

unread,
Jun 24, 2020, 6:11:31 AM6/24/20
to Selenium Users
Hi Ryan, I'm also curious—unfortunately clocked over 40 hours figuring out this and some other errors when deploying my application. Let us know if you can, thank you tons!

Ryan Farrell

unread,
Jun 24, 2020, 6:25:56 AM6/24/20
to seleniu...@googlegroups.com
It was a long time ago, but are you using the terminal on vscode or are you using the one on the computer itself, because I'm pretty sure once instated using the one on the computer rather than the program it worked for some reason. 

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/ibIWEdLvpK4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f2ad6971-96e8-4832-872a-d80acf942ea2o%40googlegroups.com.

Athithya raj

unread,
Jun 24, 2020, 7:56:30 AM6/24/20
to seleniu...@googlegroups.com
Are you using Linux cron tab to run? And got those exception

On Sun 3 May, 2020, 7:22 PM ReGenesis CHC, <mahan...@gmail.com> wrote:
Have you found any solution?

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

Jim March

unread,
Jul 7, 2020, 3:39:41 AM7/7/20
to Selenium Users
After a week of struggling with the same error, I found that I needed the following line typed at the command line ($) of the environment I was using:

export DISPLAY=":0"

In my case, this allowed Visual Studio Code 1.46.1 to open an output screen on my console when running Python 3.6.9 with Selenium 3.141.0 and Pytest 5.4.3 modules. Will it work for you? Don't know. It was such a simple thing that worked. Not sure why. Something to do with session display output routing? NOTE: When I want to run the Python program using the Selenium webdriver WITHOUT the session display output coming to my console, I can run the webdriver "headless".

Hope this helps more than hinders...
Reply all
Reply to author
Forward
0 new messages