`

Selenium Tutorial -9 WebDriver Entire Setup and Installation with Eclipse

 
阅读更多

http://www.softwaretestinghelp.com/webdriver-eclipse-installation-selenium-tutorial-9/

 

In the previous tutorial, we introduced the basic architecture and features of WebDriver. This is 9th tutorial in Selenium Tutorial Training Series.

In this tutorial, we would be discussing about the installation procedure to get started with WebDriver initiating from the scratch. We would also be discussing about the diverse range of drivers provided by WebDriver, each catering to different testing and environmental needs.

To be able to use WebDriver for scripting, there are some pre-requisites that need to be in place like the basic environment setup. In this series, we would be using Java as a programming language within our sample examples. Thus let us kick start with the Java installation.

Java Installation

Step 1: Go to Oracle official site – “JAVA download”, download Java Platform, Standard Edition. All the recent releases are available on the page.

webdriver installtion with eclipse 1

Step 2: As soon as you click on the Download button, following screen would appear. Accept the License agreement for Java installation and choose amongst the various catalogued Java Development Kit’s. Select the one that best suits your system configuration.

webdriver installtion with eclipse 2

Remember to download JDK (Java development kit). The kit comes with a JRE (Java Runtime environment). Thus the user isn’t required to download and install the JRE separately.

Eclipse IDE Installation

Step 1: Go to Eclipse official website and navigate to its download page – Eclipse download. Download Eclipse IDE for Java EE developers. All the recent releases are available on the page.

Make sure you opt and download the appropriate eclipse IDE as per your system configuration. There are two download links available for 64 bit windows operating system and 32-bit windows operating system.

webdriver installtion with eclipse 3

Step 2: As soon as we click on the download link, the user is re-directed to the fresh page securing information about the current download. Click on the download icon and you are done.

webdriver installtion with eclipse 4

It may take a few minutes before you can download the complete zip folder.

Step 3: Once downloaded, copy the folder and place it in the desired location on your file system.

webdriver installtion with eclipse 5

Step 4: Extract the zipped folder, a folder named as eclipse can be seen. The folder embodies all the required application and source files.

webdriver installtion with eclipse 6

Step 5: Launch the eclipse IDE using “eclipse.exe” residing inside the eclipse folder. Refer the above illustration for the same.

Step 6: The application will prompt you to specify the workspace location. Workspace is that location where all your eclipse projects will be residing. Enter/Browse the desired location or the user can simply opt for the default location and click on the OK button.

webdriver installtion with eclipse 7

Configuring WebDriver

As we would be using Java as the programming language for this series and in order to create test scripts in java, we would have to introduce language- specific client drivers. Thus, let us begin with the downloading of Selenium Java Client Libraries.

Download the Selenium Java Client Libraries

Step 1: Go to Selenium’s official website and navigate to its download page – “http://docs.seleniumhq.org/download/”. Refer the section in the below illustration where you can find Client Libraries listed for distinct programming languages. Click on the download link for Java Client Library.

webdriver installtion with eclipse 8

It may take a few minutes before you can download the complete zipped folder.

Step 2: Once downloaded, copy the folder and place it in the desired location on your file system.

Step 3: Extract the zipped folder, a folder named as “Selenium-2.41.0.zip“can be seen. The folder embodies all the required jar files which enable users to create test scripts in Java.

Thus these libraries can be configured in Eclipse IDE.

Configuring Libraries with Eclipse IDE

Step 1: Navigate towards Eclipse IDE. Create a new java based project following File -> New -> Java Project. Refer the following figure for the same.

webdriver installtion with eclipse 9

------------

Step 2: Provide a user defined name for your Java Project. Let us provide the name as Learning_Selenium and Click on the Finish Button. The newly created project can be viewed at the left side of the screen in the package explorer panel.

Step 3: Create a new Java class named as “First_WebdriverClass” under the source folder by right clicking on it and navigating to New -> class.

Step 4: Now let us configure the libraries into our Java project. For this, select the project and Right click on it. Select “Properties” within the listed options. The following screen appears, Select “Java Build Path” from the options.

webdriver installtion with eclipse 10

Step 5: By default, “Libraries” tab is opened. If not, click on the “Libraries” tab. Then, click on the “Add External Jars…” button. Browse to the location where we have saved the extracted folder for Java Client Libraries.

Step 6: Select all the JAR files present in the “selenium-java-2.41.0” folder and click on open button within the dialog box. The properties dialog box should look like the below illustration.

webdriver installtion with eclipse 11

Step 7: Click on the “OK” button within the dialog box so as to complete the configuration part of Selenium Libraries in our java project.

The project will look like the following:

webdriver installtion with eclipse 12

Available Drivers                                                                                                  

There are a number of driver classes available in WebDriver, each catering a specific web browser. Each browser has a different driver implementation in WebDriver.

In WebDriver, a few of the browsers can be automated directly where as some of the web browsers require an external entity to be able to automate and execute the test script. This external entity is known as Driver Server. Thus, user is required to download the Driver Server for different web browsers.

Notice that there is a separate Driver Server for each of the web browser and user cannot use one Driver Server for web browsers other than the one it is designated for.

Below is the list of available web browsers and their corresponding Server Drivers.

webdriver installtion with eclipse 13

Conclusion

In this tutorial, we accustomed you with all the environment setup and installation to be done prior to creation of WebDriver test scripts.

Here are the cruxes of this article.

  • Prior to the creation of WebDriver based test scripts, few utilities and packages are required to be installed.
  • Install JDK (Java Development Kit). Remember, the user is not supposed to install JRE separately because it is distributed bundled with the kit.
  • Download Eclipse IDE. User is only required to download the package and he/she is good to go. No other installation is required with Eclipse.
  • Download Java Client Libraries to be able to create test script in java programming language.
  • Launch eclipse using eclipse.exe. Select the workspace where you would want to save the projects.
  • Create a new java project in the eclipse. Create a new java class within the project.
  • Configure the eclipse by importing jars files for Java Client Drivers.
  • In WebDriver, a few of the browsers can be automated directly where as some of the web browsers require an external Driver Server.
  • Firefox and HTML Unit are the only browsers that cannot be automated directly. Thus they do not require any separate Driver Server. All other commonly known web browsers like Chrome, Safari, Internet Explorer etc. requires Driver Servers.

Next Tutorial #10 => Now that we are done with the entire setup and installation, in the next tutorial we would create our own WebDriver test script using Java.

A remark for the readers: While our next tutorial of the Selenium tutorials series is in the processing mode, install the packages mentioned in this tutorial and the required utilities to get started. Most of the WebDriver related packages can be found at the Selenium’s official website.

分享到:
评论

相关推荐

    ruby+selenium-webdriver测试--第一个例子源代码

    Ruby+Selenium-Webdriver是一个强大的自动化测试工具组合,用于模拟真实用户在浏览器中与网页进行交互。Ruby是一种动态、面向对象的编程语言,而Selenium WebDriver是一个开源的自动化测试框架,支持多种浏览器和...

    selenium-webdriver-2.45.0.gem

    selenium-webdriver-2.45.0.gem

    selenium-webdriver介绍PPT

    selenium-webdriver原创selenium-webdriver原创selenium-webdriver原创selenium-webdriver原创

    Selenium-Webdriver系列教程

    Selenium-Webdriver系列教程旨在引导读者理解和掌握Selenium 2.0,即WebDriver的核心概念、常用方法和高级功能。Selenium 1.x虽然已被弃用,但由于丰富的资源和历史积累,仍然被许多人广泛使用。然而,随着Selenium ...

    selenium-webdriver-2.40.0.gem

    selenium-webdriver-2.40.0.gem

    selenium-webdriver-api文档

    这个文档,`selenium-API-2.12.chm`,是针对Selenium WebDriver 2.12版本的详细指南,对于理解和使用WebDriver API至关重要。 ### 1. WebDriver 概念 WebDriver 是一种接口,它提供了对浏览器的直接控制,支持多种...

    selenium-webdriver-2.24.0.gem

    注意selenium-webdriver只支持1.8.7以上的ruby版本; 使用gem安装selenium-webdriver;打开命令行,输入下列代码完成安装。注意,如果你的开发环境需要http proxy的话,请注意在gem命令中加入--http_proxy参数; ...

    selenium-webdriver从入门到提高

    标题《Selenium-WebDriver从入门到提高》说明这是一本关于Selenium-WebDriver实用指南的书籍,旨在帮助读者从基础到进阶的各个层次上掌握Selenium-WebDriver的使用方法。Selenium-WebDriver作为一个自动化测试工具,...

    selenium-webdriver离线包.rar

    这个压缩包“selenium-webdriver离线包.rar”显然包含了在TypeScript或JavaScript环境中离线安装Selenium WebDriver所需的资源。 在TypeScript和JavaScript环境下使用Selenium WebDriver,首先需要理解这两者的基本...

    selenium-webdriver-2.5.0

    selenium-webdriver-2.5.0.gem

    selenium-server-standalone和Selenium-java的jar包

    首先,**selenium-server-standalone.jar**是Selenium WebDriver的核心组件,包含了WebDriver服务器的所有依赖。这个jar包让你能够与浏览器进行交互,执行各种网页操作,如点击按钮、填写表单、导航等。它提供了不同...

    ruby+selenium-webdriver测试源代码003

    在本资源中,我们关注的是使用Ruby和Selenium-Webdriver进行自动化测试的源代码,具体为"test003"。Ruby是一种流行的、动态的、面向对象的编程语言,而Selenium-Webdriver则是一个强大的工具,允许我们对浏览器进行...

    @typse-selenium-webdriver 智能提示.rar

    本教程将详细介绍如何离线安装 "@types/selenium-webdriver",以便在TypeScript项目中启用针对Selenium WebDriver的智能提示功能。 首先,让我们了解 "@types/selenium-webdriver" 的作用。这是一个npm(Node.js包...

    selenium-selenium-4.5.0.zip源码

    在 `selenium-selenium-4.5.0.zip` 源码中,我们可以深入理解 Selenium 的内部实现,包括以下关键部分: 1. **WebDriver**: 这部分包含了各个浏览器驱动(如 ChromeDriver、GeckoDriver)的实现,它们作为桥梁,...

    ruby2.0.0+selenium-webdriver+watir-webdriver+rails离线备份

    ruby2.0.0+selenium-webdriver+watir-webdriver+rails离线备份,设置环境变量后可使用(未测试)

    selenium-server-standalone-2.40

    在这个名为 "selenium-server-standalone-2.40" 的压缩包中,包含了Selenium Server的独立版本以及相关的Java库。 1. **Selenium Server Standalone**: Selenium Server Standalone是Selenium的核心组件之一,它...

    ruby+selenium-webdriver测试-测试用例源代码

    Ruby 和 Selenium-Webdriver 是一种强大的组合,用于自动化 Web 应用程序的测试。这篇博客主要探讨了如何利用这两种工具来编写测试用例,并提供了源代码示例。在这个压缩包中,我们有一个名为 "test002" 的文件,很...

    selenium-server-standalone-2.45.0和selenium-java-2.45.0(含srcs)

    总结起来,"selenium-server-standalone-2.45.0" 和 "selenium-java-2.45.0(含srcs)" 提供了Selenium的核心组件,支持Java环境下的WebDriver自动化测试,同时包含了源码以便于深入学习和定制。它们是Web应用自动化...

    selenium-server-standalone-4.0.0-alpha-2.zip

    标题 "selenium-server-standalone-4.0.0-alpha-2.zip" 指的是 Selenium 的一个服务器独立版本的归档文件,该版本为 4.0.0 的 Alpha 2 版本。Selenium 是一个广泛使用的自动化测试工具,主要用于 Web 应用程序的测试...

Global site tag (gtag.js) - Google Analytics