[Selenium2]+eclipse+java Environment Construction

Source: Internet
Author: User

First, the development environment:

1. Install the JDK:
Http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html

2. Install Eclipse
http://www.eclipse.org/downloads/

3. Install Selenium: (Java version)
http://www.selenium.com/

At present selenium official website is blocked, have the need contact contact me. or use proxy access.

Ii. new Java project and Manve project

1, JDK configuration succeeded  
2, Eclipse can use   normally,
3, Selenium (Java version now complete)

Note: The new Manve project needs to build a manve environment. For the time being, there is no need for friends to contact me. qq:807002272

  1. new Java project [open eclipse->file->new->other- >java project 
    650) this.width=650; "src=" http://img.blog.csdn.net/20150706140012616 "alt=" write a picture description here " Title= "style=" Border:none;height:auto; "/>

  2. selenium configuration to project

    Unzip the selenium and copy it to the newly created project.

    650) this.width=650; "src=" http:/ img.blog.csdn.net/20150706140813738 "alt=" here to write a picture describing "title=" "style=" Border:none;height:auto; "/>

    650) this.width=650; "src=" http://img.blog.csdn.net/20150706140930025 "alt=" here write a picture describing "title=" "style=" border:none; Height:auto; "/>

  3. Configure the jar package file to build Path

    650) this.width=650; "src=" http://img.blog.csdn.net/20150706141315172 "alt=" here write a picture describing "title=" "style=" border:none; Height:auto; "/>

    blockquote style= "margin:0px 0px 1.1em;padding:15px 20px;border-left-width:10px;border-left-style:solid;" >

    SELENIUM-JAVA-2.46.0.JAR 
    selenium-java-2.46.0-srcs.jar 
    Follow the above figure to find the 2 packages and add them. Click OK

    650) this.width=650; "Src=" http ://img.blog.csdn.net/20150706141848939 "alt=" here to write a picture describing "title=" "style=" Border:none;height:auto; "/>

Third, the test environment to build success

Create a new Java file; Enter the following code; Run with Java application.

    import org.openqa.selenium.By;    import  org.openqa.selenium.webdriver;    import org.openqa.selenium.webelement;     import org.openqa.selenium.firefox.*;    public class snippet  {    public static void main (String[] args)  {          //If Firefox is not installed by default on the C drive, you need to develop its path          system.setproperty ("Webdriver.firefox.bin",  "D:/firefox/firefox.exe");          webdriver driver = new firefoxdriver ();         driver.get ("http://wd.txiake.com/");         driver.manage (). window (). Maximize ();        webelement  Txtbox = driver.findelement (By.namE ("Q"));         txtbox.sendkeys ("20150410");         webelement btn = driver.findelement (By.id ("Global_search_btns"));         btn.click ();         Driver.close ();     } }


This article is from "an old City, memory is still." "Blog, be sure to keep this provenance http://diaosi58.blog.51cto.com/2722311/1672000

[Selenium2]+eclipse+java Environment Construction

Related Article

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.