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

Getting started with Selenium3: how to write your first script, Hello world!

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

Share

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

Write Selenium3 scripts starting at 0. Solve the problems of environment configuration that automation rookies fear most, starting from the simplest script, starting from the cleanest environment, result-oriented, step by step to the practice process of automation framework.

Required tools:

1. IDEfan JDK + browser (can be customized according to the actual project)

2.Selenium3 driver and jar package (the first driver is required in Selenium3)

Steps:

1.idea installation, download the tool and run as an administrator, all the way to next, the installation path can be default or customized. After the installation is complete, it is as follows:

2.idea cracking (due to the free 30-day trial of the professional version of intellij) Click the menu Help- > Register- > License server, and enter the address below.

3. To configure JDK, the installation of JDK and the configuration of environment variables can be found in the previous chapter. Only how to configure jdk in idea is listed here.

When you enter Idea for the first time, the new project guides you to enter.

4. Proceed to the next step

5. Waiting for loading

Upon completion of loading, you successfully entered the project interface.

6. Since you need to use Selenium3's API, you will import the prepared jar package here. Open the menu-File-Project Structure.

Click Modules

Click the + sign as shown below.

The first import needs to load something, which is a little slow.

Click OK to see the success of the imported project.

7. Next, solve the browser driver problem.

Because Selenium3 has problems running for the 40 + version of Firefox. Choose 36.

Install Firefox to the default path.

8. Download the latest geckodriver and put it in a custom directory

9. Start scripting

The code is as follows:

After clicking run, you can see that Firefox starts and searches, and closes the browser.

So far, a Selenium3 script has been successfully run!

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