The use of selenium - the second experiment of software testing

Purpose:

1) Install the SeleniumIDE plugin
2) Learn to use SeleniumIDE to record and export scripts
3) Visit https://psych.liebes.top/st and log in to the system using the student ID (the account name is the student ID, and the password is the last 6 digits of the student ID), After entering the system, you can see the git address of the classmate.
4) Write a Selenium Java WebDriver program to test whether the correspondence between the student number and the git address in the input.xlsx table is correct.

 

Experimental steps:

1) Selenium is a browser plug-in that can record website operations and export operation source code. Chrome recommends using KAtalon Automation Recoder, which can be installed directly in the store.

2) Click record to record, click {}Export to see the source code

 

3) 4) The operation of reading excel is realized through the ipo package of java. The for loop reads the student number and the corresponding git address of the students in turn, and then imports a java package of selenium to realize the operation performed by java on the web page.

 

Loop the previously read student ID and password to log in to the webpage, get the text corresponding to the git address, and compare it with the previously obtained address. If they are the same, output OK, and if they are different, output ERROR.

 

 

 

Problems encountered:

1. Some student numbers in excel are garbled after being read in: for example, E9 is added at the end

Solution: Write a clear(){} function to clean the student number

2. The reason why some git addresses do not match is that there is a space in front of the address or a '\' symbol at the end of the address, but they are the same for hyperlinks

Solution: write a clear_s(){} function, clean it up, or change equals to contains (because I think: "https://github.com/hyx22222/" and "https://github.com//hyx22222 //Software test" is all user hyx22222, it should be the same)

 

in conclusion:

Selenium is very easy to use, you can directly record and generate code, which is convenient for testing.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324400516&siteId=291194637