SeleniumManager
I'm fed up with always having to struggle unnecessarily when I have to use Selenium on a new machine, so I made this little python module for my personal use to simplify Selenium's utilisation in a new environment
usage
-
Download SeleniumManager.py
-
Download and put with SeleniumManager.py the correct firefox geckodriver here: https://github.com/mozilla/geckodriver/releases
-
Install Selenium using, for example:
python -m pip install selenium
-
Launch Python in the repertory containing SeleniumManager.py and the geckodriver
-
Import Selenium Manager by doing in the python console
import SeleniumManager
It will open the Firefox browser
. So you can:
- go to an url by typing directly in the opened browser or by typing in the python console
SeleniumManager.get(string: url)
- get elements using css-selectors by doing
SeleniumManager.find_elements(string: css-selector): SeleniumWebElement[]
- manipulate the obtained array as you want
l = SeleniumManager.find_elements("ul#list li a")
result = map(lambda el: el.text, l)
print(l)