Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.thoughtworks.selenium.*;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- public class testAddPatient extends SeleneseTestCase
- {
- public static Integer NUMBER_OF_OBJECT = 0;
- public Integer count;
- String user_name;
- String password;
- public testAddPatient()
- {
- super();
- count = NUMBER_OF_OBJECT++;
- }
- @Before
- public void setUp() throws Exception
- {
- selenium = new DefaultSelenium("localhost", 4444, "*googlechrome","http://192.168.1.118:8080/");
- selenium.start();
- }
- @Test
- public void test() throws Exception
- {
- //openurl
- selenium.windowMaximize();
- selenium.open("http://192.168.1.118:8080");
- selenium.waitForPageToLoad("2000");
- selenium.click("link=here");
- //login
- selenium.waitForPageToLoad("30000");
- if(count == 0)
- {
- selenium.type("id=frmLogin:txtUserName","kaustubhk");
- selenium.type("id=frmLogin:txtPassword","kaustubh123");
- }
- else if(count==1)
- {
- selenium.type("id=frmLogin:txtUserName","sriharis");
- selenium.type("id=frmLogin:txtPassword","asdf1234");
- }
- else if(count==2)
- {
- selenium.type("id=frmLogin:txtUserName","sheetalk");
- selenium.type("id=frmLogin:txtPassword","sheetal123");
- }
- else if(count==3)
- {
- selenium.type("id=frmLogin:txtUserName","chittak");
- selenium.type("id=frmLogin:txtPassword","chitta123");
- }
- else if(count==4)
- {
- selenium.type("id=frmLogin:txtUserName","gayatrip1");
- selenium.type("id=frmLogin:txtPassword","asdf1234");
- }
- else if(count==5)
- {
- selenium.type("id=frmLogin:txtUserName","vikasm");
- selenium.type("id=frmLogin:txtPassword","asdf1234");
- }
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- .
- else if(count==17)
- {
- selenium.type("id=frmLogin:txtUserName","vidyap");
- selenium.type("id=frmLogin:txtPassword","vidya123");
- }
- selenium.click("name=frmLogin:j_idt17");
- Thread.sleep(2000);
- if(selenium.isElementPresent("link=Login Forcefully"))
- {
- selenium.click("link=Login Forcefully");
- }
- selenium.waitForPageToLoad("40000");
- //Add new patient
- selenium.click("css=input.addptBtn");
- selenium.type("id=txtAddPtFname", "Himani");
- selenium.type("id=txtAddPtLname", "Paur");
- selenium.select("css=select[name*='j_idt']", "Miss");
- selenium.type("id=txtAddPtAge", "30");
- selenium.select("id=ddAddPtGender", "label=Female");
- selenium.type("id=txtAddPtAreaCode", "12321");
- selenium.type("id=txtAddPtHomePhone", "32132132");
- selenium.click("//input[@value='Add Patient']");
- selenium.click("//input[@value='Ok']");
- selenium.type("name=txtAddApptCC","acidity");
- selenium.click("//input[@value='Schedule Appointment']");
- Thread.sleep(5000);
- //Add new patient
- selenium.click("css=input.addptBtn");
- selenium.type("id=txtAddPtFname", "Ketaki");
- selenium.type("id=txtAddPtLname", "Paudwal");
- selenium.select("css=select[name*='j_idt']", "Miss");
- selenium.type("id=txtAddPtAge", "30");
- selenium.select("id=ddAddPtGender", "label=Female");
- selenium.type("id=txtAddPtAreaCode", "12321");
- selenium.type("id=txtAddPtHomePhone", "32132132");
- selenium.click("//input[@value='Add Patient']");
- selenium.click("//input[@value='Ok']");
- selenium.type("name=txtAddApptCC","acidity");
- selenium.click("//input[@value='Schedule Appointment']");
- Thread.sleep(5000);
- //Add new patient
- selenium.click("css=input.addptBtn");
- selenium.type("id=txtAddPtFname", "Shriya");
- selenium.type("id=txtAddPtLname", "Dhani");
- selenium.select("css=select[name*='j_idt']", "Miss");
- selenium.type("id=txtAddPtAge", "30");
- selenium.select("id=ddAddPtGender", "label=Female");
- selenium.type("id=txtAddPtAreaCode", "12321");
- selenium.type("id=txtAddPtHomePhone", "32132132");
- selenium.click("//input[@value='Add Patient']");
- selenium.click("//input[@value='Ok']");
- selenium.type("name=txtAddApptCC","acidity");
- selenium.click("//input[@value='Schedule Appointment']");
- Thread.sleep(5000);
- //Add new patient
- selenium.click("css=input.addptBtn");
- selenium.type("id=txtAddPtFname", "Meena");
- selenium.type("id=txtAddPtLname", "Londhe");
- selenium.select("css=select[name*='j_idt']", "Miss");
- selenium.type("id=txtAddPtAge", "30");
- selenium.select("id=ddAddPtGender", "label=Female");
- selenium.type("id=txtAddPtAreaCode", "12321");
- selenium.type("id=txtAddPtHomePhone", "32132132");
- selenium.click("//input[@value='Add Patient']");
- selenium.click("//input[@value='Ok']");
- selenium.type("name=txtAddApptCC","acidity");
- selenium.click("//input[@value='Schedule Appointment']");
- Thread.sleep(5000);
- ///Add new patient
- selenium.click("css=input.addptBtn");
- selenium.type("id=txtAddPtFname", "Pritisha");
- selenium.type("id=txtAddPtLname", "Sowani");
- selenium.select("css=select[name*='j_idt']", "Miss");
- selenium.type("id=txtAddPtAge", "30");
- selenium.select("id=ddAddPtGender", "label=Female");
- selenium.type("id=txtAddPtAreaCode", "12321");
- selenium.type("id=txtAddPtHomePhone", "32132132");
- selenium.click("//input[@value='Add Patient']");
- selenium.click("//input[@value='Ok']");
- selenium.type("name=txtAddApptCC","acidity");
- selenium.click("//input[@value='Schedule Appointment']");
- Thread.sleep(5000);
- }
- @After
- public void tearDown() throws Exception
- {
- selenium.click("id=actLogout");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement