From 9122e36155968722692532b775b4ab9c7c19780c Mon Sep 17 00:00:00 2001 From: rjsdn1120 Date: Wed, 27 Sep 2023 14:52:09 +0900 Subject: [PATCH 1/2] add .gitignore for .pyc --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore 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 From ed74349a6e06cbedfd333311eeed1b2c36b9f5df Mon Sep 17 00:00:00 2001 From: rjsdn1120 Date: Wed, 27 Sep 2023 14:52:38 +0900 Subject: [PATCH 2/2] dependency update --- requirements.txt | 4 ++-- srt_reservation/main.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) 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}")