Commit 1316377b authored by Watchtek's avatar Watchtek
Browse files

Change user input on chrome driver

parent 74f1db2b
Loading
Loading
Loading
Loading
Loading
+49 −12
Original line number Diff line number Diff line
@@ -23,13 +23,49 @@ class MultipleTest(unittest.TestCase):
    def _get_user_inputs(self):
        """Helper method to get user inputs and set up initial configuration."""
        # Test case user input
        # while True:
        #     # Linux Only
        if sys.platform.startswith('linux'): # Check if the operating system is Linux
            chrome_path = "/usr/bin/google-chrome-stable"
            if os.path.exists(chrome_path) and os.path.isfile(chrome_path):
                self.binary_location = chrome_path
                print("크롬이 이미 설치되어 있습니다.\n다음 입력으로 넘어갑니다.\n")
            else:
                print("크롬 설치후 스크립트 재실행 바랍니다.\n스크립트를 종료합니다\n")
                sys.exit(1)

        else: # is Windows
            chrome_path = r"C:\Program Files\Google\Chrome\Application\chrome.exe"
            if os.path.exists(chrome_path) and os.path.isfile(chrome_path):
                print("기존에 설치된 크롬을 사용하시겠습니까? (y/N): ")
                ans = input().strip().lower()
                if ans in ("y", "yes"):
                    self.binary_location = chrome_path
                else:
                    print("크롬 드라이버 위치를 절대경로로 입력해 주세요")
                    print("1. [필수 입력] Chrome 위치 (e.g., D:\\tmp\\chrome-win64\\chrome.exe): ")
                    while True:
                        chrome_path = input().strip()

                        if not chrome_path:
                            print("잘못 입력하였습니다. 다시 입력해주세요.\n")

                        if os.path.exists(chrome_path) and os.path.isfile(chrome_path):
                            self.binary_location = chrome_path
                            break

                        print(f"입력한 경로가 존재하지 않거나 파일이 아닙니다: {chrome_path}")
                        print("다시 입력해주세요.\n")

            else:
                print("크롬이 설치되어 있지 않습니다")
                print("크롬 드라이버 위치를 절대경로로 입력해 주세요")
                print("1. [필수 입력] Chrome 위치 (e.g., D:\\tmp\\chrome-win64\\chrome.exe): ")
                while True:
            print("1. [필수 입력] Chrome 위치 (e.g., /opt/chrome-linux64/chrome, D:\\tmp\\chrome-win64\\chrome.exe): ")
                    chrome_path = input().strip()

                    if not chrome_path:
                        print("잘못 입력하였습니다. 다시 입력해주세요.\n")
                continue

                    if os.path.exists(chrome_path) and os.path.isfile(chrome_path):
                        self.binary_location = chrome_path
@@ -48,7 +84,7 @@ class MultipleTest(unittest.TestCase):

        self.account_configs = []
        print("\n3. [필수 입력] 계정유형(1-어드민,2-(지역)관리자,3-사용자) / 계정 접속정보")
        print("형식 예시: 1 / admin, admin")
        print("입력 예시: 1 / admin, admin")

        while True:
            user_input = input("").strip()
@@ -83,6 +119,7 @@ class MultipleTest(unittest.TestCase):


        print("\n5. [선택] 커넥션 수 / 테스트 시간(분)(기본값: 30개 / 120분)")
        print("입력 예시: 30 / 120")
        try:
            pool_input = input().strip().split('/')
            self.max_connections = int(pool_input[0].strip()) if pool_input[0].strip() else 30