Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webdirver 버전 업데이트 #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
selenium==3.141.0
webdriver_manager==3.2.2
selenium
webdriver_manager
7 changes: 4 additions & 3 deletions srt_reservation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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}")
Expand Down