@@ -31060,9 +31060,10 @@ class PuppeteerPage {
3106031060 return this.page.url();
3106131061 });
3106231062 }
31063- goto(url) {
31063+ goto(url, options ) {
3106431064 return __awaiter$6(this, void 0, void 0, function* () {
31065- yield this.page.goto(url, { waitUntil: 'load' });
31065+ const waitUntil = (options === null || options === void 0 ? void 0 : options.waitUntil) === 'idle' ? 'networkidle0' : 'load';
31066+ yield this.page.goto(url, { waitUntil });
3106631067 });
3106731068 }
3106831069 fill(selector, value) {
@@ -31283,9 +31284,10 @@ class PlaywrightPage {
3128331284 return this.page.url();
3128431285 });
3128531286 }
31286- goto(url) {
31287+ goto(url, options ) {
3128731288 return __awaiter$4(this, void 0, void 0, function* () {
31288- yield this.page.goto(url, { waitUntil: 'load' });
31289+ const waitUntil = (options === null || options === void 0 ? void 0 : options.waitUntil) === 'idle' ? 'networkidle' : 'load';
31290+ yield this.page.goto(url, { waitUntil });
3128931291 });
3129031292 }
3129131293 fill(selector, value) {
@@ -31483,10 +31485,10 @@ function isPuppeteer(configs) {
3148331485}
3148431486
3148531487const URLS = {
31486- MAIN: 'https://dhlottery.co.kr/main',
31487- LOGIN: 'https://dhlottery.co.kr/login',
31488+ MAIN: 'https://www. dhlottery.co.kr/main',
31489+ LOGIN: 'https://www. dhlottery.co.kr/login',
3148831490 LOTTO_645: 'https://ol.dhlottery.co.kr/olotto/game/game645.do',
31489- CHECK_WINNING: 'https://dhlottery.co.kr/qr.do'
31491+ CHECK_WINNING: 'https://www. dhlottery.co.kr/qr.do'
3149031492};
3149131493
3149231494const getLastLottoRound = () => {
@@ -51398,10 +51400,10 @@ class LottoService {
5139851400 if (this.browserController.configs.controller === 'api') {
5139951401 throw LottoError.NotSupported('API mode does not support signIn.');
5140051402 }
51401- // 페이지 이동
51403+ // 페이지 이동 (RSA 키 로딩 등 비동기 스크립트 완료까지 대기)
5140251404 const page = yield this.browserController.focus(0);
5140351405 this.logger.debug('[signIn]', 'goto', 'login page');
51404- yield page.goto(URLS.LOGIN);
51406+ yield page.goto(URLS.LOGIN, { waitUntil: 'idle' } );
5140551407 this.logger.debug('[signIn]', 'page url', yield page.url());
5140651408 // 로그인 시도
5140751409 this.logger.debug('[signIn]', 'try login');
@@ -51421,13 +51423,32 @@ class LottoService {
5142151423 yield this.browserController.cleanPages([0]);
5142251424 return page.getCookies();
5142351425 }
51426+ // 디버깅 정보 수집
51427+ const debugInfo = {
51428+ currentUrl,
51429+ isStillOnLoginPage: currentUrl.includes(URLS.LOGIN),
51430+ hasErrorPopup: yield page.exists(SELECTORS.LOGIN_ERROR_POPUP),
51431+ hasLoginButton: yield page.exists(SELECTORS.LOGIN_BUTTON),
51432+ hasIdInput: yield page.exists(SELECTORS.ID_INPUT),
51433+ errorPopupMessage: null
51434+ };
51435+ // 에러 팝업 메시지 추출 시도
51436+ if (debugInfo.hasErrorPopup) {
51437+ try {
51438+ const messages = yield page.querySelectorAll(SELECTORS.LOGIN_ERROR_POPUP, elems => elems.map(el => el.innerHTML.replace(/<[^>]*>/g, ' ').trim()));
51439+ debugInfo.errorPopupMessage = messages.join(' | ');
51440+ }
51441+ catch (_a) {
51442+ debugInfo.errorPopupMessage = '[failed to extract]';
51443+ }
51444+ }
5142451445 // 실패: 로그인 에러 팝업 확인
5142551446 if (yield page.exists(SELECTORS.LOGIN_ERROR_POPUP, CONST.LOGIN_ERROR_MESSAGE)) {
51426- this.logger.info('[signIn]', 'failed', 'credentials incorrect');
51447+ this.logger.info('[signIn]', 'failed', 'credentials incorrect', debugInfo );
5142751448 throw LottoError.CredentialsIncorrect();
5142851449 }
5142951450 // 기타 실패
51430- this.logger.info ('[signIn]', 'failed', 'unknown' );
51451+ this.logger.warn ('[signIn]', 'failed', 'unknown reason', debugInfo );
5143151452 throw LottoError.CredentialsIncorrect();
5143251453 });
5143351454 this.purchase = (amount = 5) => __awaiter(this, void 0, void 0, function* () {
0 commit comments