Below is a code snippet that I used in calling data used in a .txt file in validating a simple test in user name password based sign-in process. I was on Selenium RC/JUnit/Java platform in this.
public class SignIn extends SeleneseTestCase { public void setUp() throws Exception { setUp("https://localhost:9443/carbon/", "*chrome"); } public void testSignInValdation() throws Exception { BufferedReader in = null; InputStreamReader inputStream = null; inputStream = new InputStreamReader(new FileInputStream("C:" + File.separator + "signin.txt")); in = new BufferedReader(inputStream); String line = null; while ((line = in.readLine()) != null) { System.out.println("password: " + line); selenium.open("/carbon/admin/login.jsp"); selenium.waitForPageToLoad("30000"); selenium.type("txtUserName", "yumani"); selenium.type("txtPassword", line); selenium.click("//input[@value='Sign-in']"); selenium.waitForPageToLoad("30000"); } } }
No comments:
Post a Comment