imho it’s recommended to solve things without 3rd party packages (which might possible be neglected (no more security updates) or even hijacked after some time)
it is sometimes agreed upon to extend python’s capabilities with 3rd party packages like psutil (for system and process monitoring)
how to install pip (python package manager) (github src 99% python):
# tested for debian + ubuntu su - root apt update # should work apt install pip # but more correct, package is called apt -y install python3-pip apt show python3-pip Package: python3-pip Version: 23.0.1+dfsg-1 Priority: optional Section: python Source: python-pip Maintainer: Debian Python Team <(does not want spam)> Installed-Size: 6,838 kB Provides: pip Depends: ca-certificates, python3-distutils, python3-setuptools, python3-wheel, python3:any Recommends: build-essential, python3-dev (>= 3.2) Breaks: python-pip Replaces: python-pip Homepage: https://pip.pypa.io/en/stable/ Download-Size: 1,325 kB Description: Python package installer pip is the Python package installer. It integrates with virtualenv + doesn't do partial installs + can save package state for replaying + can install from non-egg sources, + and can install from version control repositories. This is the Python 3 version of the package.
search for a package here https://pypi.org/
AS NON ROOT USER (NO ROOT REQUIRED) install a package:
pip install packagename
list all installed packages:
pip list|less
update all packages:
# strange enough there is no pip3 update && pip3 upgrade, but a rather complex construct must be used?
pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
getting started with robot + selenium gui testing framework
as non-root user: install those 3 packages
pip install robotframework pip install robotframework-seleniumlibrary pip install webdrivermanager wget https://github.com/mozilla/geckodriver/releases/download/v0.35.0/geckodriver-v0.35.0-linux64.tar.gz tar fxvz geckodriver-v0.35.0-linux64.tar.gz chmod +x geckodriver # as root ln -sv /home/user/software/geckodriver /usr/local/bin/
# log off root
Ctrl+D
# continue non-root
create test script to test if selenium works
vim selenium_test.py
with this content
# does work
from selenium import webdriver
import time
from time import sleep
driver = webdriver.Firefox()
driver.get("http://dwaves.org")
time.sleep(8)
driver.quit()
print("test success")
run it:
python3 ./selenium_test.py
if this error pops up: Your Firefox profile cannot be loaded. It may be missing or inaccessible.
it is because firefox was installed via snap and not apt
uninstall it via snap and re-install it with apt
su - root
snap remove firefox;
install -d -m 0755 /etc/apt/keyrings;
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null;
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
Package: firefox*
Pin: release o=Ubuntu
Pin-Priority: -1' | sudo tee /etc/apt/preferences.d/mozilla;
apt update && sudo apt remove firefox;
apt install firefox;
# try re running the test
python3 ./selenium_test.py
if the dev user sees the website opening and browser closing after 8 sec
celebrate! 😀
what should also work…
- open website
- enter “selenium” into search textinput
- hit enter
create script
vim ./selenium_test_submit_form.robot
# test_suite.robot v1.0 # open duckduckgo in firefox browser (installed via apt not snap) # enter "selenium" in search field # submit the form *** Settings *** Library SeleniumLibrary *** Variables *** ${SEARCH_TERM} selenium *** Test Cases *** Open Dwaves And Search selenium Open Browser https://dwaves.org Firefox Input Text name=s ${SEARCH_TERM} Submit Form searchform Sleep 5 seconds Close Browser *** Test Cases *** Open DuckDuckGo And Search Selenium Open Browser https://duckduckgo.com Firefox Input Text name=q ${SEARCH_TERM} Submit Form searchbox_homepage Sleep 5 seconds Close Browser
WARNING! THE MASSIVE AMOUNTS OF SPACES (AT LEAST 4?) IS ON PURPOSE AND IT MIGHT NOT RUN WITHOUT AT LEAST 4 SPACES!
it might be useful to get more verbose output in a specified dir:
mkdir output
robot -d output --loglevel DEBUG selenium_test_submit_form.robot
nokia’s eclipse red vs vscode extension
long story short:
vscode:
[+] step debugging script.robot works
[+] follow variable definition with ctrl key works
eclipse2020 or eclipse2024+red:
[-] not developed since 2020 (probably because it is in competition with vscode and M$ bought nokia in 2014)
[-] editor did not work yet (tried 2024 version, tried 2020 version with this url https://sourceforge.net/projects/red-robot-editor/files/)
Links + creditz
- how to manually install webdriver https://www.youtube.com/watch?v=pNo27xOap_w
- https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!