Setting User Name and Password Values

At runtime, if the web server or web proxy requires NTLM or Basic Authentication, then this authentication is automatically handled, providing data dictionary values are set for the data items user and password.

There are several methods by which user and password values can be assigned, as explained below:

Unique Values for Every Virtual User

Create a data table with columns names user and password.

Create a row for each virtual user (VU) containing the values as shown in the following example:

user,password
tom,gyug5g52
dick,jrkg5gk4g
harry,78gu645d
Note: The table can be tab- or comma-delimited.

Assign this data source to any VU Groups running scripts that require authentication.

Single User and Password for All Users in a Group

In-line Data

Set values for user and password in the Global variables section of the Data tab for the test.

Data Dictionary

In a Data Dictionary file assigned to multiple VU Groups.

Create data similar to the following:

user = mytestuser

password = yuiyui5ui45ui

Insert Code in the Script

You can explicitly set username and password values by using the following code:

Java Code

this.getWebBrowser().setUserPassword("myuser", "mypassword");

or

this.getWebBrowser().setUserPassword(getString("user", "myuser"), getString("password", "mypassword"));

C# Code

this.WebBrowser.SetUserPassword("myuser", "mypassword");

or

this.WebBrowser.SetUserPassword(GetString("user", "myuser"), GetString("password", "mypassword"));

The more complex Java and C# code examples extract values for user and password from the VU data dictionary, and use the default values "myuser" and "mypassword" if the data dictionary doesn't include these values.

This code is automatically inserted in the script by the web script generator if the Server or proxy Authentication Required checkbox is selected on the Authentication tab of the Web Generation Options dialog box for a web script.

 

This topic was last updated on June 21, 2019, at 02:49:50 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant