1) selenium+ Java integration, in-depth project process application

Source: Internet
Author: User

Selenium1,selenium IDE mac installation Open the Firefox browser, go to the following URL https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/, Click Add to Firefox. Can be added to the toolbar.  2,SELENIUM1) version of the jar package download: http://selenium-release.storage.googleapis.com/ Index.html the system uses the 2.50.1 to create a new Java project in Eclipse, the project name right-click the new class and tick automatically generate main, then right-click the project name, select Properties-->java Build Path, on the Libraries tab, click Add External JARs the Selenium-java-2.50.1.jar that you unzipped above, and then click Add External JARs to add libs inside the Java-related base System.out.print ("Hello World"), write a main function, ("World"); Run 2) Download and start the Selenium server: Download Selenium-server-standalone-2.50.1.jar above start with the following command: java-jar/users/vip/downloads/ SELENIUM-SERVER-STANDALONE-2.50.1.JAR3) Install chrome driver, the corresponding version of the driver information: 51896672 the corresponding version of the driver to any of the following links to download: The system uses 2.37http:// npm.taobao.org/mirrors/chromedriver/http://selenium-release.storage.googleapis.com/index.htmlhttp:// Chromedriver.storage.googleapis.com/index.html after the download is complete, unzip, and then copy to the/usr/local/bin directory, open. Opening cannot be copied, requires permission, use the following command sudo mv/ USERS/VIP/DOWNLOADS/CHROMEDRIVER/USR/LOCAL/BIN4) then go to eclipse and add the following code to run. ImpORT org.openqa.selenium.by;import Org.openqa.selenium.webdriver;import Org.openqa.selenium.chrome.ChromeDriver;  public class SeleniumTestCase1 { public static void main (string[] args) {Webdriver driver = new Chromedriver (); Driver.get ("http://www.baidu.com");d river.findelement (by.id ("kw")). SendKeys ("Messi"); try {thread.sleep (2000);} catch (Interruptedexception e) {e.printstacktrace ();}  driver.findelement (By.id ("su")). Click (); try {thread.sleep (10000);} catch (Interruptedexception e) { E.printstacktrace ();} Driver.quit ();}  } This is selenium2, object-oriented, and different objects have different methods of operation. If selenium 1 is programmed as follows defaultselenium selenium = new Defaultselenium ("localhost", 4444, "*firefox", "http://www.baidu.com/" ); Selenium.start (); Selenium.open ("http://www.baidu.com"); try {thread.sleep (10000);} catch (Interruptedexception e) {E.printstacktrace ();} Selenium.goback ();

1) selenium+ Java integration, application for deep project flow

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.