nateshmbhat / webbot

Web automation library for simple and easy end to end testing and web browser automation that offers super charged features while keeping it simple to use and master
https://pypi.org/project/webbot/
Mozilla Public License 2.0
239 stars 87 forks source link

aarch64 GNU/Linux support #28

Open kamikaze opened 4 years ago

kamikaze commented 4 years ago

Currently I'm able to install webbot but not instantiate Browser

>>> web = Browser()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.venv38/lib64/python3.6/site-packages/webbot/webbot.py", line 52, in __init__
    self.driver = webdriver.Chrome(executable_path=driverpath , chrome_options=options)
  File "/.venv38/lib64/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/.venv38/lib64/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/.venv38/lib64/python3.6/site-packages/webbot/drivers/chrome_linux'
cgoldberg commented 4 years ago

OSError: [Errno 8] Exec format error: '/.venv38/lib64/python3.6/site-packages/webbot/drivers/chrome_linux'

AFAICT, there is no ChromeDriver binary available for aarch64. The only version for Linux that the Chromium project ships is compiled for x86-64.

tgikal commented 4 years ago

If you're using a raspberry pi (Which I guess is just arm64, but you might try something similar), this appears to be a workaround: (Tested on a raspberry pi 4, python 3.7.3)

open terminal: pip3 install webbot

sudo apt install chromium-chromedriver

sudo cp /usr/lib/chromium-browser/chromedriver /usr/local/lib/python3.7/dist-packages/webbot/drivers/chrome_linux

You'll have to run as su, unless you comment out os.chmod(driverpath , 0o755 ) I'm sure this driver could be added to the project.

Mykadlo commented 3 years ago

tgikal - I have tried your solution on raspberry pi but I am getting: selenium.common.exceptions.WebDriverException: Message: chrome not reachable (Session info: chrome=86.0.4240.197) Do you have any idea what can be wrong?

tgikal commented 3 years ago

Mykadlo - The driver is not finding a version of chromium it likes.

I haven't needed to update this for a while, so I don't have anything to test it on. I can only suggest making sure everything is up to date, sudo apt update sudo apt upgrade make sure chromium is installed: sudo apt install chromium Make sure the location /usr/lib/chromium-browser actually contains the chrome driver, they may have moved it or something. cd /usr/lib/chromium-browser, dir check what version python you're using: python3 --version and copy the driver to the relevant webbot driver folder.

It's currently working for me with python 3.7.3-1, chromium 78.0.3904.108-rptl, chromium-chromedriver 78.0.3904.108-rptl, and webbot 0.1.4 (selenium 3.141.0)

Edit - So yeah, I'm running a way older version of webbot, I'd look at what they've changed in the driver usage since then. I'd try downgrading selenium to 3.141.0: sudo pip3 uninstall selenium sudo pip3 install selenium==3.141.0 Its only 2 versions old and they're not super focused on making things work for the raspberry pi.

Mykadlo commented 3 years ago

thanks tgikal. I am just adding what worked for me:

sudo apt install chromium
sudo apt-get install chromium-chromedriver

this installed /usr/lib/chromium-browser/chromedriver which is symlink to chromedriver.

Then I replaced chrome-linux file in webbot/drivers directory with symlink to chromedriver, in my case like this: sudo mv chrome_linux chrome_linux_bak sudo ln -s /usr/lib/chromium-browser/chromedriver chrome_linux