Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Web:selenium Automation practice

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

web automation tool selection

Selenium is open source and free;

watir

loadrunner

QTP

Selenium development history

2004--

Tool set:

selenium IDE -fixfox plugin

selenium remote control (RC)--support js, complex tests

selenium Grid --distributed execution of tests, multiple machines, multiple systems

selenium WebDriver --native browser support, advanced tests for creating columns, scripting support in multiple languages

Selenium environment preparation

Workflow:

script--selenium --browser software

Steps:

Install Fixfox

Installing Java Environment

install eclipse

Selenium Development Project:

Creating Java Projects

lib library creation--new folder

Download selenium server jar package locally

paste this jar package under libs

java build path--add jar package

The diagram illustrates the whole project environment configuration process

1. Open Eclipse

2. Create a new project

3. Create a net folder named libs

4. Download selenium jar package locally, download address:

http://docs.seleniumhq.org/download/

Selenium-server-standalone-2.52.0.jar is required.

You can also add source packages

selenium-java-2.53.1.jar、selenium-java-2.53.1-srcs.jar ;

5. Drag the package downloaded in step 4 directly to the libs folder

6. Follow these steps to add jar package to

7. Click OK, you can;

8. Create a class and write a script.

The base script template is:

public class test {

public static void main(String[] args) {

WebDriver driver = new FirefoxDriver();

driver.get("http://photo.163.com ");

WebElement name = driver.findElement(By.name("username"));

WebElement password = driver.findElement(By.name("password"));

WebElement login = driver.findElement(By.id("photo_index_login"));

//randomly click a dot on the screen to remove a hint div

WebElement loginview = driver.findElement(By.id("photo_index_login_hint"));

name.sendKeys("ynotetest30@163.com");

//click the screen randomly to remove a hint div

loginview.click();

password.sendKeys("****);

login.click();

//Close browser

driver.quit();

}

}

example

search Selenium

Element positioning: xpath

Additional:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report