1.5. Downloading Selenium server¶
In this Selenium tutorial, we learn about the prerequisites of Selenium testing and their installation. The prerequisites include Java Development Kit, an ID.
Now, you can follow these steps to download the Microsoft webdriver: First check the version of your OS build. Based on your OS version build, you have to download the corresponding Edge driver. You can download the Selenium Java Client Driver here. You will find client drivers for other languages there, but only choose the one for Java. This download comes as a ZIP file named 'selenium-3.14.0.zip'. For simplicity, extract the contents of this ZIP file on your C drive so that you would have the directory 'C: selenium-3.14.0 '. Download the certificate and install in the machine Download the certificate in the download tab. The certificate is downloaded as “safariextension.cer”. Double-click on the file to install the certificate in the Mac client/OSX.
Note
The Selenium server is only required if you want to use the remoteWebDriver. See the Using Selenium with remote WebDriver section for moredetails. If you are a beginner learning Selenium, you can skip this sectionand proceed with next chapter.
Selenium server is a Java program. Java Runtime Environment (JRE) 1.6 or newerversion is recommended to run Selenium server.
You can download Selenium server 2.x from the download page of selenium website. The file name should be something likethis: selenium-server-standalone-2.x.x.jar
. You can always download thelatest 2.x version of Selenium server.
If Java Runtime Environment (JRE) is not installed in your system, you candownload the JRE from the Oracle website. If youare using a GNU/Linux system and have root access in your system, you can alsouse your operating system instructions to install JRE.
If java command is available in the PATH (environment variable), you can startthe Selenium server using this command:
Replace 2.x.x with the actual version of Selenium server you downloaded fromthe site.
If JRE is installed as a non-root user and/or if it is not available in the PATH(environment variable), you can type the relative or absolute path to the javacommand. Similarly, you can provide a relative or absolute path to Seleniumserver jar file. Then, the command will look something like this:
Selenium Scripts are built to do some tedious tasks which can be automated using headless web browsers.
For example, Searching for some Questions on Different Search engines and storing results in a file by visiting each link. This task can take a long for a normal human being but with the help of selenium scripts one can easily do it
Now, Some of You may be wondering what is headless web browsers. It’s nothing but a browser that can be controlled using these selenium scripts for automation(web tasks). Selenium Scripts can be programmed using various languages such as JavaScript, Java, Python, etc.
How to Use selenium with Python and Linux Environment.
Python should already be installed. It can be 2.* or 3.* version.
Steps:
- Installing Selenium
- Installing Webdrivers (headless)
- Creating Simple Code
Installing Selenium
Whatever Operating System You are Using Python command is Same for Installing Selenium Library.
First Method
Open Terminal/Cmd and Write Command as written Below
Second Method
Alternatively, you can download the source distribution here, unarchive it, and run the command below:
Installing Webdrivers
One Can Install Firefox, Chromium, PhantomJs(Deprecated Now), etc.
- for using Firefox you may need to install GeckoDriver
- for using Chrome you may need to install Chromium
In this article, Firefox is used so One can Follow the Bellow Steps to Install:-
Steps for Linux:- Google chrome desktop download.
1. Go to the geckodriver releases page. Find the latest version of the driver for your platform and download it.
For example:
2. Extract the file with:
3. Make it executable:
4. Move Files to usr/local/bin
Steps for Windows:-
1. Same as Step 1 in Linux Download the GeckoDriver
2. Extract it using WinRar or any application you may have.
3. Add it to Path using Command Prompt
For Example:-
Creating Simple Code
# selenium driver = webdriver.Firefox() |
Output:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Recommended Posts:
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the 'Improve Article' button below.