user1425557
user1425557

Reputation: 1

how to save string as variable using WebDriver and later use tis variable in another test

I have problem with saving user name and password. After registration, user get username and password on the registration page. I want to store this username and password as variable and later to use it. This works fine with store text and javascript in Selenium IDE, but this do not work in WebDriver using Java. Any idea?

Upvotes: 0

Views: 1073

Answers (1)

Franz Ebner
Franz Ebner

Reputation: 5106

Is that what you mean?

import static org.junit.Assert.*;

import org.junit.Test;


public class AbcTest {

    static String aString = "";

    @Test
    public void test1() {

        aString = "abc";

    }

    @Test
    public void test2() {

        assertTrue(aString.equals("abc"));

    }

}

Upvotes: 1

Related Questions