This code uses selenium for web browser automation and a module of Python who extract the data.
The example code is in Python (version 3.6 or higher will work).
- import selenium (For more information, see)
- import time
- import xlrd (module is used to extract data from a spreadsheet)
ex: pip install selenium
Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. 🌐 Through Selenium Python API you can access all functionalities of Selenium WebDriver in an intuitive way.
Selenium Python bindings provide a convenient API to access Selenium WebDrivers like Firefox, Ie, Chrome, Remote etc. The current supported Python versions are 2.7, 3.5 and above. 💫
Selenium requires a driver to interface with the chosen browser. Firefox, for example, requires geckodriver, which needs to be installed before the below examples can be run. Make sure it’s in your PATH, e. g., place it in /usr/bin or /usr/local/bin.
Failure to observe this step will give you an error selenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH.
Other supported browsers will have their own drivers available. Links to some of the more popular browser drivers follow.
- Firefox: https://github.com/mozilla/geckodriver/releases
- Chrome: https://sites.google.com/a/chromium.org/chromedriver/downloads
- Edge: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
- Safari: https://webkit.org/blog/6900/webdriver-support-in-safari-10
I used it for internship for add users who were in a spreadsheet on wordpress.
To run the code, type python Automated_Add_User.py
python Automated_Add_User.py