Web Automation Test (Java)---environment building

Source: Internet
Author: User

The Java test environment is simpler to build than Python, as long as the relevant jar package is imported.

1. Install Java

Download the latest Java installer from the official website and double-click Install (java1.8)

2. Download the Java version of the Selenium jar package (including client and server-side jar packages)

  

Client and service side

  

3. Import Jar Package

Create a new project in Eclipse, then right-click the project and select "Build Path"-"Configure Build Path"

  

4. Import Jar Package

  

5, after the import can create test class for testing, the following is a basic open web page operation:

  

Package Seleniumtest;import Java.util.concurrent.timeunit;import Org.openqa.selenium.webdriver;import Org.openqa.selenium.firefox.firefoxdriver;public class Firstselenium {public static void main (String args[]) { System.setproperty ("Webdriver.firefox.bin", "D:\\Program Files\\mozilla firefox\\firefox.exe"); Webdriver Driver = new Firefoxdriver ();d river.manage (). window (). Maximize ();d river.manage (). Timeouts (). Implicitlywait (8, Timeunit.seconds);d river.get ("http://www.baidu.com");d river.quit ();}}

  

  

Web Automation Test (Java)---environment building

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.