Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Python] selenium webdriver help

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
ramack
Posts: 499
Joined: 2008-01-28 15:31
Location: Centennial, CO
Has thanked: 6 times

[Python] selenium webdriver help

#1 Post by ramack »

Hi,
I'm needing help from you Python pros....I've got a pretty basic/simple Python script that scrapes a website and modifies some stuff in my account. The script works with Python2, but I'm wanting to get it to work in the python3 environment. I switch to python2 by:
$ sudo -s update-alternatives --config python
and selecting option 1.

After a bit of troubleshooting, I've narrowed it down to something with selenium and firefox. Just executing select commands from IDLE causes the firefox related errors below.

Code: Select all

import time, os, datetime, selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    driver = webdriver.Firefox()
  File "/usr/lib/python3/dist-packages/selenium/webdriver/firefox/webdriver.py", line 194, in __init__
    self.service.start()
  File "/usr/lib/python3/dist-packages/selenium/webdriver/common/service.py", line 106, in start
    self.assert_process_still_running()
  File "/usr/lib/python3/dist-packages/selenium/webdriver/common/service.py", line 119, in assert_process_still_running
    raise WebDriverException(f"Service {self.path} unexpectedly exited. Status code was: {return_code}")
selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: 1

However, if instead of firefox, I attempt the same with chrome, it opens and closes without issue.

Code: Select all

driver = webdriver.Chrome()
driver.close()
Any suggestions???
homemade AMD64, Acer AspireOne 150, Asus eeePC 900, i386; Testing
i386,Dell Vostro 1000 AMD64, Dell Inspiron 1100; Sid
XFCE on all.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 72 times

Re: [Python] selenium webdriver help

#2 Post by stevepusser »

I think the versions of Firefox, selenium, and geckodriver (possibly that one's embedded in Firefox) will be crucial to solving the issue.

Have you done a websearch on that error message?
MX Linux packager and developer

User avatar
ramack
Posts: 499
Joined: 2008-01-28 15:31
Location: Centennial, CO
Has thanked: 6 times

Re: [Python] selenium webdriver help

#3 Post by ramack »

Yup, thanks for responding. One thing that I tried last night was to include the path to the binary. While it didn't resolve the issue, it did produce a different error "DeprecationWarning: firefox_profile has been deprecated, please pass in an Options object". I'm looking into what that involves as a resolution.
homemade AMD64, Acer AspireOne 150, Asus eeePC 900, i386; Testing
i386,Dell Vostro 1000 AMD64, Dell Inspiron 1100; Sid
XFCE on all.

Post Reply