案例一之后执行开关案例二

时间:2016-02-18 04:45:26

标签: java selenium-webdriver

//这是我的java代码

public static void main(String[] args) throws Exception {
    try {
        FirefoxDriver driver = new FirefoxDriver();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedReader reader1 = new BufferedReader(new InputStreamReader(System.in));


        Login module = new Login(driver, "http://180.211.114.147:97/Account/Login");
        module.doLogin("devrana", "dev123");

        Demat_Account dmat = new Demat_Account();

        Will_Mgmt wmgt = new Will_Mgmt();


        System.out.println("-----Select Module-----");
        System.out.println("1. Demat Account");
        System.out.println("2. Will Management");


        System.out.println("Select Module :");

        try {
            int role = Integer.parseInt(reader.readLine());

            switch (role) {
            case 1:
                System.out.println("you have selected Demat Account ");
                dmat.gotoDemat();
                System.out.println("-----Select Operation-----");
                System.out.println("1. Add Demat Account");
                System.out.println("2. Edit Demat Account");
                System.out.println("3. Delete Demat Account");
                int operation = Integer.parseInt(reader.readLine());

                switch (operation) {
                case 1:
                    System.out.println("1. you have selected Add Demat Account");
                    dmat.AddDemat();
                    break;
                case 2: {
                    System.out.println("2. you have selected Edit Demat Account");
                    break;
                }

                case 3: {
                    System.out.println("3.you have selected Delete Demat Account");
                    dmat.deleteDemat();
                    break;
                }

                }


            case 2:
                System.out.println("you have selected Will Management  ");
                wmgt.gotoWillmgt();
                System.out.println("-----Select Operation-----");
                System.out.println("11. Edit will Template");
                System.out.println("22. Proceed to will Distribution");

                int will_operation = Integer.parseInt(reader1.readLine());

                switch (will_operation) {
                case 11:

                    break;

                case 22:
                    wmgt.AddWill();
                    break;
                }
            }
        } catch (NumberFormatException nfe) {
            System.err.println("Invalid Format!");
        }

    } catch (Exception ex) {

    }
}

//输出控制台

            Login success!!
           -----Select Module-----
             1. Demat Account
             2. Will Management
        Select Module :
        1
        you have selected Demat Account 
gotoDemat method
-----Select Operation-----
1. Add Demat Account
2. Edit Demat Account
3. Delete Demat Account
1 
1. you have selected Add Demat Account
Success!!
you have selected Will Management 
Will Mgt method
Success  1 !!
-----Select Operation-----
11. Edit will Template
22. Proceed to will Distribution

1 个答案:

答案 0 :(得分:0)

请编辑代码的以下部分

}
    break; // add break here
case 2:
    System.out.println("you have selected Will Management  ");