diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e99e36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 614dcf6..fd438a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -selenium==3.141.0 -webdriver_manager==3.2.2 \ No newline at end of file +selenium +webdriver_manager \ No newline at end of file diff --git a/srt_reservation/main.py b/srt_reservation/main.py index 1485754..2841af0 100644 --- a/srt_reservation/main.py +++ b/srt_reservation/main.py @@ -13,8 +13,6 @@ from srt_reservation.exceptions import InvalidStationNameError, InvalidDateError, InvalidDateFormatError, InvalidTimeFormatError from srt_reservation.validation import station_list -chromedriver_path = r'C:\workspace\chromedriver.exe' - class SRT: def __init__(self, dpt_stn, arr_stn, dpt_dt, dpt_tm, num_trains_to_check=2, want_reserve=False): """ @@ -60,7 +58,7 @@ def set_log_info(self, login_id, login_psw): def run_driver(self): try: - self.driver = webdriver.Chrome(executable_path=chromedriver_path) + self.driver = webdriver.Chrome() except WebDriverException: self.driver = webdriver.Chrome(ChromeDriverManager().install()) @@ -105,6 +103,9 @@ def go_search(self): self.driver.execute_script("arguments[0].setAttribute('style','display: True;')", elm_dpt_tm) Select(self.driver.find_element(By.ID, "dptTm")).select_by_visible_text(self.dpt_tm) + # type of train + self.driver.find_element(By.ID, "trnGpCd300").click() + print("기차를 조회합니다") print(f"출발역:{self.dpt_stn} , 도착역:{self.arr_stn}\n날짜:{self.dpt_dt}, 시간: {self.dpt_tm}시 이후\n{self.num_trains_to_check}개의 기차 중 예약") print(f"예약 대기 사용: {self.want_reserve}")