Get the App
SLTechnology News&Howtos  ›  Database  › 

Selenium-- links the MySQL database and writes data to the database

Shulou Source: shulou.com Published: 2022-06-01 12:14:07 11月15日 Update

Today, I will tell you how to write the data you want to the specified database when doing automated testing.

The database is ready and the table is established.

I have built a database called test. There are many tables under this library, and the table will be used later.

The structure of the table is set according to the actual project situation.

This is id name password.

Note: remember to set the database connection user name and password, generally default to the user is root, the password is empty. You can change it yourself.

The following is a script that registers a user on the * * 1024 software and writes the user to the database

After registering, we linked to the database, linked through mysql.connector.connect, and entered the set users.

First name and password.

After the link is successful, the data is written to the database by inserting statements.

Let's execute this script.

The result indicates that the registration was successful:

OK, let's open the database to see if the newly registered user and password have been written to the * under the database test.

It's in the watch.

We see that the user who has just signed up for jock593 has been written to the database.

At this point, we are able to write the data to the specified database. Communication QQ group with problems: 610845268

Tags: Data database user password link success user name script actual situation time structure result statement software problem project library stand up communicate Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Tech Info Huawei Linux Shulou Technology