posting_zon 3.107.999 → 3.110.999

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/posting_zon.rb +654 -207
  3. metadata +2 -2
data/lib/posting_zon.rb CHANGED
@@ -691,97 +691,90 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
691
691
 
692
692
  #오른쪽 마우스 해제 코드
693
693
  begin
694
- @driver.execute_script <<-JS
695
- document.querySelectorAll('body').forEach(function(element) {
696
- element.oncontextmenu = null;
697
- });
698
- document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
699
- JS
700
-
701
- @driver.execute_script <<-JS
702
- document.addEventListener('contextmenu', function(e) {
703
- e.stopImmediatePropagation();
704
- }, true);
694
+ # 우 클릭 해제
695
+ @driver.execute_script <<~JS
696
+ window.alert = function() {};
697
+ document.addEventListener('contextmenu', event => event.stopPropagation(), true);
698
+ document.oncontextmenu = null;
699
+ document.body.oncontextmenu = null;
705
700
  JS
706
-
707
- @driver.execute_script("window.oncontextmenu = null;")
708
701
  rescue
709
- end
702
+ end
710
703
 
711
704
 
712
705
 
713
706
  sleep(1)
714
- ##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
715
-
716
- puts '-[√] 1 캡챠 발생 유무 확인.......'.green
717
- sleep(1)
718
- puts '-[√] 2 캡챠 발생 유무 확인.......'.green
719
- sleep(1)
720
- puts '-[√] 3 캡챠 발생 유무 확인.......'.green
721
- sleep(2)
707
+ ##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
708
+
709
+ puts '-[√] 1 캡챠 발생 유무 확인.......'.green
710
+ sleep(1)
711
+ puts '-[√] 2 캡챠 발생 유무 확인.......'.green
712
+ sleep(1)
713
+ puts '-[√] 3 캡챠 발생 유무 확인.......'.green
714
+ sleep(2)
722
715
 
723
716
 
724
717
 
725
- begin
726
- @driver.find_element(:xpath, '//*[@class="amzn-captcha-state-container"]')
727
- puts '-[√] 아임웹 캡챠 확인!! 해제 실행.......'.green
728
- sleep(1)
729
- # 타임아웃을 3초로 설정
730
- wait = Selenium::WebDriver::Wait.new(:timeout => 5)
731
- # 요소가 나타날 때까지 3초 동안 기다립니다.
732
- wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
733
- sleep(1)
734
- @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
735
- puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
736
- sleep(10)
737
- begin
738
- @driver.find_element(:xpath, '//*[@data-state="error"]').click
739
- puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
740
- puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
741
- @driver.window_handles.each do |handle|
742
- @driver.switch_to.window(handle)
743
- begin
744
- # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
745
- @driver.close
746
- rescue Selenium::WebDriver::Error::WebDriverError => e
747
- puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
748
- end
718
+ begin
719
+ @driver.find_element(:xpath, '//*[@class="amzn-captcha-state-container"]')
720
+ puts '-[√] 아임웹 캡챠 확인!! 해제 실행.......'.green
721
+ sleep(1)
722
+ # 타임아웃을 3초로 설정
723
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
724
+ # 요소가 나타날 때까지 3초 동안 기다립니다.
725
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
726
+ sleep(1)
727
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
728
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
729
+ sleep(10)
730
+ begin
731
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click
732
+ puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
733
+ puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
734
+ @driver.window_handles.each do |handle|
735
+ @driver.switch_to.window(handle)
736
+ begin
737
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
738
+ @driver.close
739
+ rescue Selenium::WebDriver::Error::WebDriverError => e
740
+ puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
741
+ end
742
+ end
743
+ sleep(1)
744
+ @driver.quit
745
+ return 0
746
+ sleep(1)
747
+ rescue
748
+ begin
749
+ # 타임아웃을 77초로 설정
750
+ wait = Selenium::WebDriver::Wait.new(:timeout => 150)
751
+ # 요소가 나타날 때까지 100초 동안 기다립니다.
752
+ #wait.until { @driver.find_element(:xpath, '//*[@class="post_write_wrap"]') }
753
+ wait.until { @driver.find_elements(:xpath, '//*[@id="amzn-captcha-verify-button"]').size == 0 }
754
+ puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
755
+
756
+ sleep(5)
757
+ rescue => e
758
+ puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
759
+ puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
760
+ puts e
761
+ @driver.close
762
+ return 0
749
763
  end
750
- sleep(1)
751
- @driver.quit
752
- return 0
753
- sleep(1)
754
- rescue
755
- begin
756
- # 타임아웃을 77초로 설정
757
- wait = Selenium::WebDriver::Wait.new(:timeout => 150)
758
- # 요소가 나타날 때까지 100초 동안 기다립니다.
759
- #wait.until { @driver.find_element(:xpath, '//*[@class="post_write_wrap"]') }
760
- wait.until { @driver.find_elements(:xpath, '//*[@id="amzn-captcha-verify-button"]').size == 0 }
761
- puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
762
-
763
- sleep(5)
764
- rescue => e
765
- puts '-[√] 캡챠 해제 실패(캡챠는 사람이 풀기에 간혹 실수로 실패가 될수있습니다.).......'.red
766
- puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
767
- puts e
768
- @driver.close
769
- return 0
770
- end
771
- end
772
- rescue
773
- begin
774
- @driver.find_element(:xpath, '//*[@class="zone-name-title h1"]')
775
- puts '-[√] 클라우드플레어 캡챠 확인!! 해제 실행.......'.green
776
-
777
- # 타임아웃을 3초로 설정
778
- wait = Selenium::WebDriver::Wait.new(:timeout => 5)
779
- # 요소가 나타날 때까지 30초 동안 기다립니다.
780
- wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
781
- sleep(1)
782
- @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
783
- puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
784
- sleep(10)
764
+ end
765
+ rescue
766
+ begin
767
+ @driver.find_element(:xpath, '//*[@class="zone-name-title h1"]')
768
+ puts '-[√] 클라우드플레어 캡챠 확인!! 해제 실행.......'.green
769
+
770
+ # 타임아웃을 3초로 설정
771
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
772
+ # 요소가 나타날 때까지 30초 동안 기다립니다.
773
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
774
+ sleep(1)
775
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
776
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
777
+ sleep(10)
785
778
  begin
786
779
  @driver.find_element(:xpath, '//*[@data-state="error"]').click
787
780
  puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
@@ -2008,24 +2001,16 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
2008
2001
 
2009
2002
  sleep(1)
2010
2003
  ##캡챠 이미지,2캡챠,,등등 코드 부분─────────────────────────────────────────────────────────────────────>
2011
- #오른쪽 마우스 해제 코드
2012
- begin
2013
- @driver.execute_script <<-JS
2014
- document.querySelectorAll('body').forEach(function(element) {
2015
- element.oncontextmenu = null;
2016
- });
2017
- document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
2018
- JS
2019
-
2020
- @driver.execute_script <<-JS
2021
- document.addEventListener('contextmenu', function(e) {
2022
- e.stopImmediatePropagation();
2023
- }, true);
2004
+ begin
2005
+ # 우 클릭 해제
2006
+ @driver.execute_script <<~JS
2007
+ window.alert = function() {};
2008
+ document.addEventListener('contextmenu', event => event.stopPropagation(), true);
2009
+ document.oncontextmenu = null;
2010
+ document.body.oncontextmenu = null;
2024
2011
  JS
2025
-
2026
- @driver.execute_script("window.oncontextmenu = null;")
2027
2012
  rescue
2028
- end
2013
+ end
2029
2014
  sleep(1)
2030
2015
  ##캡챠 이미지,2캡챠,,등등 코드 부분─────────────────────────────────────────────────────────────────────>
2031
2016
  puts '-[√] 캡챠 유형 탐색.......'.green
@@ -3726,24 +3711,16 @@ login_url = option['login_url'].to_s
3726
3711
  sleep(1)
3727
3712
 
3728
3713
  ##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
3729
- #오른쪽 마우스 해제 코드
3730
- begin
3731
- @driver.execute_script <<-JS
3732
- document.querySelectorAll('body').forEach(function(element) {
3733
- element.oncontextmenu = null;
3734
- });
3735
- document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
3736
- JS
3737
-
3738
- @driver.execute_script <<-JS
3739
- document.addEventListener('contextmenu', function(e) {
3740
- e.stopImmediatePropagation();
3741
- }, true);
3714
+ begin
3715
+ # 우 클릭 해제
3716
+ @driver.execute_script <<~JS
3717
+ window.alert = function() {};
3718
+ document.addEventListener('contextmenu', event => event.stopPropagation(), true);
3719
+ document.oncontextmenu = null;
3720
+ document.body.oncontextmenu = null;
3742
3721
  JS
3743
-
3744
- @driver.execute_script("window.oncontextmenu = null;")
3745
3722
  rescue
3746
- end
3723
+ end
3747
3724
 
3748
3725
  sleep(5)
3749
3726
 
@@ -5177,25 +5154,17 @@ begin
5177
5154
 
5178
5155
 
5179
5156
 
5180
- sleep(1)
5181
- #오른쪽 마우스 해제 코드
5157
+ sleep(1)
5182
5158
  begin
5183
- @driver.execute_script <<-JS
5184
- document.querySelectorAll('body').forEach(function(element) {
5185
- element.oncontextmenu = null;
5186
- });
5187
- document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
5159
+ # 우 클릭 해제
5160
+ @driver.execute_script <<~JS
5161
+ window.alert = function() {};
5162
+ document.addEventListener('contextmenu', event => event.stopPropagation(), true);
5163
+ document.oncontextmenu = null;
5164
+ document.body.oncontextmenu = null;
5188
5165
  JS
5189
-
5190
- @driver.execute_script <<-JS
5191
- document.addEventListener('contextmenu', function(e) {
5192
- e.stopImmediatePropagation();
5193
- }, true);
5194
- JS
5195
-
5196
- @driver.execute_script("window.oncontextmenu = null;")
5197
5166
  rescue
5198
- end
5167
+ end
5199
5168
  ##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
5200
5169
  begin
5201
5170
  sleep(5)
@@ -5569,22 +5538,14 @@ post_url = option['post_url'].to_s
5569
5538
  end
5570
5539
 
5571
5540
  sleep(1)
5572
- #오른쪽 마우스 해제 코드
5573
5541
  begin
5574
- @driver.execute_script <<-JS
5575
- document.querySelectorAll('body').forEach(function(element) {
5576
- element.oncontextmenu = null;
5577
- });
5578
- document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
5579
- JS
5580
-
5581
- @driver.execute_script <<-JS
5582
- document.addEventListener('contextmenu', function(e) {
5583
- e.stopImmediatePropagation();
5584
- }, true);
5542
+ # 우 클릭 해제
5543
+ @driver.execute_script <<~JS
5544
+ window.alert = function() {};
5545
+ document.addEventListener('contextmenu', event => event.stopPropagation(), true);
5546
+ document.oncontextmenu = null;
5547
+ document.body.oncontextmenu = null;
5585
5548
  JS
5586
-
5587
- @driver.execute_script("window.oncontextmenu = null;")
5588
5549
  rescue
5589
5550
  end
5590
5551
 
@@ -5979,7 +5940,7 @@ post_url = option['post_url'].to_s
5979
5940
  begin
5980
5941
  chat_box = @driver.find_element(:xpath, '//*[@class="left_chat_box"]')
5981
5942
  @driver.execute_script("arguments[0].remove();", chat_box)
5982
-
5943
+
5983
5944
  sleep(1)
5984
5945
  rescue
5985
5946
  end
@@ -5992,6 +5953,14 @@ post_url = option['post_url'].to_s
5992
5953
  rescue
5993
5954
  end
5994
5955
 
5956
+ begin
5957
+ @driver.execute_script(<<~JS)
5958
+ document.querySelectorAll('.captcha-solver[data-widget-id="100000"]').forEach(el => el.remove());
5959
+ JS
5960
+
5961
+ puts "가짜 캡차 관련 요소 제거 완료".green
5962
+ rescue
5963
+ end
5995
5964
 
5996
5965
 
5997
5966
 
@@ -6842,7 +6811,13 @@ begin
6842
6811
  sleep(1)
6843
6812
  puts '-[√] 닉네임 26코드 타겟.......'.yellow
6844
6813
  rescue
6845
-
6814
+ begin
6815
+ @driver.find_element(xpath: '//*[@data-valid-title="작성자"]').send_keys(user_id)
6816
+ sleep(1)
6817
+ puts '-[√] 닉네임 26코드 타겟.......'.yellow
6818
+ rescue
6819
+
6820
+ end
6846
6821
  end
6847
6822
  end
6848
6823
  end
@@ -6986,7 +6961,13 @@ begin
6986
6961
  sleep(1)
6987
6962
  puts '-[√] 패스워드 20코드 타겟.......'.yellow
6988
6963
  rescue
6989
-
6964
+ begin
6965
+ @driver.find_element(:xpath, '//*[@data-valid-title="비밀번호"]').send_keys(user_pw)
6966
+ sleep(1)
6967
+ puts '-[√] 패스워드 21코드 타겟.......'.yellow
6968
+ rescue
6969
+
6970
+ end
6990
6971
  end
6991
6972
  end
6992
6973
  end
@@ -7479,7 +7460,15 @@ begin
7479
7460
  sleep(1)
7480
7461
  @driver.find_element(:xpath, '//*[@type="checkbox" and @name="fagree" and @name="fagree"]').click
7481
7462
  sleep(1)
7463
+ rescue
7464
+ begin
7465
+ check = @driver.find_element(:xpath, '//div[@class="write_div"]//input[@type="checkbox" and @required]')
7466
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", check)
7467
+ sleep(1)
7468
+ @driver.find_element(:xpath, '//div[@class="write_div"]//input[@type="checkbox" and @required]').click
7469
+ sleep(1)
7482
7470
  rescue
7471
+ end
7483
7472
  end
7484
7473
  end
7485
7474
  end
@@ -7520,7 +7509,10 @@ begin
7520
7509
 
7521
7510
 
7522
7511
 
7523
-
7512
+ begin
7513
+ @driver.switch_to.default_content
7514
+ rescue
7515
+ end
7524
7516
 
7525
7517
 
7526
7518
 
@@ -7550,6 +7542,13 @@ sleep(1)
7550
7542
  puts '-[√] 제목 code 3.......'.yellow
7551
7543
  rescue
7552
7544
  begin
7545
+ target_element = @driver.find_element(xpath: "//input[@id='subject' and @name='subject']")
7546
+ @driver.find_element(xpath: "//input[@id='subject' and @name='subject']").click
7547
+ sleep(1)
7548
+ @driver.find_element(xpath: "//input[@id='subject' and @name='subject']").send_keys(title)
7549
+ puts '-[√] 제목 code 3-1.......'.yellow
7550
+ rescue
7551
+ begin
7553
7552
  target_element = @driver.find_element(:xpath, '//*[@name="title"]')
7554
7553
  @driver.find_element(:xpath, '//*[@name="title"]').click
7555
7554
  sleep(1)
@@ -7672,6 +7671,13 @@ puts '-[√] 제목 code 21.......'.yellow
7672
7671
  rescue
7673
7672
  begin
7674
7673
 
7674
+ target_element = @driver.find_element(:xpath, '//label[@for="subject" and contains(@class, "i_label")]')
7675
+ @driver.find_element(:xpath, '//label[@for="subject" and contains(@class, "i_label")]').send_keys(title)
7676
+ sleep(1)
7677
+ puts '-[√] 제목 code 21-1.......'.yellow
7678
+ rescue
7679
+ begin
7680
+
7675
7681
  target_element = @driver.find_element(:xpath, '//*[@name="title"]')
7676
7682
  @driver.find_element(:xpath, '//*[@name="title"]').send_keys(title)
7677
7683
  sleep(1)
@@ -7845,12 +7851,28 @@ target_element = @driver.find_element(:xpath, '//*[@name="tx_article_title"]')
7845
7851
  @driver.find_element(:xpath, '//*[@name="tx_article_title"]').send_keys(title)
7846
7852
  sleep(1)
7847
7853
  puts '-[√] 제목 code 46.......'.yellow
7854
+ rescue
7855
+ begin
7856
+ target_element = @driver.find_element(:xpath, '//*[@data-valid-title="제목"]')
7857
+ @driver.find_element(:xpath, '//*[@data-valid-title="제목"]').send_keys(title)
7858
+ sleep(1)
7859
+ puts '-[√] 제목 code 47.......'.yellow
7860
+ rescue
7861
+ begin
7862
+ #클릭 안될때 자바로 강제 클릭 시도 하기
7863
+ target_element = @driver.find_element(:xpath, '//input[@name="title" and @type="text"]')
7864
+ @driver.execute_script("arguments[0].scrollIntoView(true);", target_element)
7865
+ sleep(1)
7866
+ @driver.execute_script("arguments[0].click();", target_element) # 클릭 (JS)
7867
+ target_element.send_keys(title) # 텍스트 입력
7868
+ sleep(1)
7869
+ puts '-[√] 제목 code 48.......'.yellow
7848
7870
  rescue
7849
7871
  begin
7850
7872
  target_element = @driver.find_element(:xpath, '//*[@id="csTitle"]')
7851
7873
  @driver.find_element(:xpath, '//*[@id="csTitle"]').send_keys(title)
7852
7874
  sleep(1)
7853
- puts '-[√] 제목 code 47.......'.yellow
7875
+ puts '-[√] 제목 code 49.......'.yellow
7854
7876
  rescue => e
7855
7877
  puts '-[√] 제목 입력 항목 코드 탐색 실패!!.......'.red
7856
7878
  puts '-[√] 다음 작업 준비 중으로 1~60 초 정도 기다려주세요.......'.red
@@ -7871,6 +7893,9 @@ rescue
7871
7893
  return 0
7872
7894
  sleep(1)
7873
7895
  end
7896
+ end
7897
+ end
7898
+ end
7874
7899
  end
7875
7900
  end
7876
7901
  end
@@ -7878,6 +7903,7 @@ end
7878
7903
  end
7879
7904
  end
7880
7905
  end
7906
+ end
7881
7907
  end
7882
7908
  end
7883
7909
  end
@@ -7988,7 +8014,6 @@ end
7988
8014
  @driver.find_element(:xpath, '//*[@alt="코드"]').click
7989
8015
  rescue
7990
8016
  begin
7991
-
7992
8017
  html_bb = @driver.find_element(:xpath, '//*[@title="HTML 편집기"]')
7993
8018
  @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
7994
8019
  puts '-[√] HTML 코드 8 code.......'.yellow
@@ -7996,7 +8021,6 @@ end
7996
8021
  @driver.find_element(:xpath, '//*[@title="HTML 편집기"]').click
7997
8022
  rescue
7998
8023
  begin
7999
-
8000
8024
  html_bb = @driver.find_element(:xpath, '//*[@name="tag"]')
8001
8025
  @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
8002
8026
  puts '-[√] HTML 코드 9 code.......'.yellow
@@ -8222,33 +8246,48 @@ end
8222
8246
  sleep(1)
8223
8247
  rescue
8224
8248
  begin
8225
- if target_element
8226
- # 3. 제목 요소 바로 아래에 체크박스 HTML 삽입
8227
- checkbox_html = <<~HTML
8228
- <div class="custom-control custom-checkbox custom-control-inline">
8229
- <input type="checkbox" name="html" value="html2" id="html" onclick="html_auto_br(this);" class="custom-control-input">
8230
- <label class="custom-control-label" for="html"><span>HTML</span></label>
8231
- </div>
8232
- HTML
8233
- @driver.execute_script("arguments[0].insertAdjacentHTML('afterend', arguments[1]);", target_element, checkbox_html)
8234
- puts '체크박스 HTML 강제 적용.......'.green
8249
+ # 1. 첫 번째 iframe (id="namoIframe0") 진입
8250
+ @driver.switch_to.frame(@driver.find_element(:id, 'namoIframe0'))
8251
+ # 2. 두 번째 iframe (id="NamoSE_Ifr__namo0") 진입
8252
+ @driver.switch_to.frame(@driver.find_element(:id, 'NamoSE_Ifr__namo0'))
8253
+ html_bb = @driver.find_element(:xpath, '//*[@data-button-id="html"]')
8254
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
8235
8255
  sleep(1)
8236
-
8237
- # 4. 삽입한 체크박스 스크롤하여 화면 중앙으로 이동
8238
- html_checkbox = @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]')
8239
- @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_checkbox)
8256
+ @driver.find_element(:xpath, '//*[@data-button-id="html"]').click
8257
+ @driver.switch_to.default_content
8258
+ puts '-[√] HTML 코드 33 code.......'.yellow
8240
8259
  sleep(1)
8241
-
8242
- # 5. HTML 토글 버튼 클릭
8243
- @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]').click
8244
- puts '-[√] 임의 추가 HTML 코드 01 code.......'.yellow
8245
- sleep(1)
8246
-
8247
- else
8248
- puts "타겟 제목 요소가 없어서 체크박스 삽입 불가".red
8249
- end
8250
8260
  rescue
8251
-
8261
+ begin
8262
+ @driver.switch_to.default_content
8263
+ if target_element
8264
+ # 3. 제목 요소 바로 아래에 체크박스 HTML 삽입
8265
+ checkbox_html = <<~HTML
8266
+ <div class="custom-control custom-checkbox custom-control-inline">
8267
+ <input type="checkbox" name="html" value="html2" id="html" onclick="html_auto_br(this);" class="custom-control-input">
8268
+ <label class="custom-control-label" for="html"><span>HTML</span></label>
8269
+ </div>
8270
+ HTML
8271
+ @driver.execute_script("arguments[0].insertAdjacentHTML('afterend', arguments[1]);", target_element, checkbox_html)
8272
+ puts '체크박스 HTML 강제 적용.......'.green
8273
+ sleep(1)
8274
+
8275
+ # 4. 삽입한 체크박스 스크롤하여 화면 중앙으로 이동
8276
+ html_checkbox = @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]')
8277
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_checkbox)
8278
+ sleep(1)
8279
+
8280
+ # 5. HTML 토글 버튼 클릭
8281
+ @driver.find_element(:xpath, '//*[@type="checkbox" and @name="html"]').click
8282
+ puts '-[√] 임의 추가 HTML 코드 01 code.......'.yellow
8283
+ sleep(1)
8284
+
8285
+ else
8286
+ puts "타겟 제목 요소가 없어서 체크박스 삽입 불가".red
8287
+ end
8288
+ rescue
8289
+
8290
+ end
8252
8291
  end
8253
8292
  end
8254
8293
  end
@@ -8356,11 +8395,15 @@ begin
8356
8395
  #아이프레임 나오기
8357
8396
  @driver.switch_to.default_content()
8358
8397
  sleep(1)
8359
- puts '내용 항목 코드 타겟 7.......'.red
8398
+ puts '내용 항목 코드 타겟 7-1.......'.red
8360
8399
  rescue
8361
8400
  begin
8401
+ @driver.find_element(:xpath, "//textarea[@name='board_body' and contains(@class, 'inputbox_')]").click
8402
+ puts '내용 항목 코드 타겟 7-2.......'.red
8403
+ rescue
8404
+ begin
8362
8405
  #아이프레임에서 코드 선택
8363
- @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@scrolling="no"]'))
8406
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//iframe[@scrolling="no"]'))
8364
8407
  @driver.find_element(:xpath, '/html').click
8365
8408
  #아이프레임 나오기
8366
8409
  @driver.switch_to.default_content()
@@ -8586,6 +8629,7 @@ sleep(1)
8586
8629
  puts '내용 항목 코드 타겟 49.......'.red
8587
8630
  rescue
8588
8631
  begin
8632
+ @driver.switch_to.default_content
8589
8633
  @driver.find_element(:xpath, '//*[@name="board_body"]').click
8590
8634
  sleep(1)
8591
8635
  puts '내용 항목 코드 타겟 50.......'.red
@@ -8601,6 +8645,22 @@ textarea = @driver.find_element(:id, 'kboard_content')
8601
8645
  @driver.find_element(:id, 'kboard_content').click
8602
8646
  puts '내용 항목 코드 타겟 52.......'.red
8603
8647
  rescue
8648
+ begin
8649
+ @driver.find_element(xpath: "//pre[contains(@class, 'CodeMirror-line')]").click
8650
+ puts '내용 항목 코드 타겟 53.......'.red
8651
+ rescue
8652
+ begin
8653
+ # 1. 첫 번째 iframe (id="namoIframe0") 진입
8654
+ @driver.switch_to.frame(@driver.find_element(:id, 'namoIframe0'))
8655
+ # 2. 두 번째 iframe (id="NamoSE_Ifr__namo0") 진입
8656
+ @driver.switch_to.frame(@driver.find_element(:id, 'NamoSE_Ifr__namo0'))
8657
+ @driver.find_element(id: 'NamoSE_editorshtml_namo0').click
8658
+ puts '내용 항목 코드 타겟 54.......'.red
8659
+ @driver.switch_to.default_content
8660
+ rescue
8661
+ end
8662
+ end
8663
+ end
8604
8664
  end
8605
8665
  end
8606
8666
  end
@@ -8686,7 +8746,10 @@ end
8686
8746
  Clipboard.copy(content)
8687
8747
  @driver.action.key_down(:control).send_keys('v').key_up(:control).perform #새로넣은 코드 (내용 한번에 복붙방식)
8688
8748
  #내용 입력<<─────────────────────────────────────────────────────────────────────
8689
-
8749
+ begin
8750
+ @driver.switch_to.default_content
8751
+ rescue
8752
+ end
8690
8753
 
8691
8754
  begin
8692
8755
  @driver.execute_script("document.body.insertAdjacentHTML('beforeend', arguments[0]);", original_html)
@@ -9645,7 +9708,10 @@ else
9645
9708
  end
9646
9709
  sleep(1)
9647
9710
  end
9648
-
9711
+ begin
9712
+ @driver.switch_to.default_content
9713
+ rescue
9714
+ end
9649
9715
  #없어도 되는 캡챠 삭제
9650
9716
  begin
9651
9717
  chat_box = @driver.find_element(:xpath, '//*[@id="mb_main_tr_kcaptcha_img"]')
@@ -9666,6 +9732,16 @@ rescue
9666
9732
  end
9667
9733
  end
9668
9734
 
9735
+ begin
9736
+ # 우 클릭 해제
9737
+ @driver.execute_script <<~JS
9738
+ window.alert = function() {};
9739
+ document.addEventListener('contextmenu', event => event.stopPropagation(), true);
9740
+ document.oncontextmenu = null;
9741
+ document.body.oncontextmenu = null;
9742
+ JS
9743
+ rescue
9744
+ end
9669
9745
 
9670
9746
  begin
9671
9747
  @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]')
@@ -9789,6 +9865,8 @@ if check_captcha == 0
9789
9865
  sleep(1)
9790
9866
  @driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
9791
9867
  sleep(1)
9868
+ @driver.execute_script("arguments[0].click();", el)
9869
+ sleep(1)
9792
9870
  mouse_move_percentage(0.3,0.02)
9793
9871
  sleep(0.5)
9794
9872
  left_click
@@ -9810,6 +9888,8 @@ if check_captcha == 0
9810
9888
  sleep(1)
9811
9889
  @driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
9812
9890
  sleep(1)
9891
+ @driver.execute_script("arguments[0].click();", el)
9892
+ sleep(1)
9813
9893
  mouse_move_percentage(0.3,0.02)
9814
9894
  sleep(0.5)
9815
9895
  left_click
@@ -10217,7 +10297,73 @@ if check_captcha == 0
10217
10297
  sleep(1)
10218
10298
  puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
10219
10299
  rescue
10220
-
10300
+ begin
10301
+ @driver.switch_to.default_content()
10302
+ el = @driver.find_element(:xpath, '//*[@alt="스팸방지코드"]')
10303
+ puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
10304
+ puts '-[√] 캡챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
10305
+ puts '-[√] 캡챠 코드 code 20.......'.red
10306
+ sleep(1)
10307
+ @driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
10308
+ sleep(1)
10309
+ mouse_move_percentage(0.3,0.02)
10310
+ sleep(0.5)
10311
+ left_click
10312
+ sleep(1)
10313
+ @driver.switch_to.window(@driver.window_handle) #핸들 주입
10314
+ @driver.action.context_click(el).perform #우 클릭
10315
+ sleep(1)
10316
+ @driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
10317
+ sleep(1)
10318
+ puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
10319
+ rescue
10320
+ begin
10321
+ @driver.switch_to.default_content()
10322
+ el = @driver.find_element(:xpath, '//img[contains(@src, "/cms/CaptCha.jsp")]')
10323
+ puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
10324
+ puts '-[√] 캡챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
10325
+ puts '-[√] 캡챠 코드 code 20.......'.red
10326
+ sleep(1)
10327
+ @driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
10328
+ sleep(1)
10329
+ mouse_move_percentage(0.3,0.02)
10330
+ sleep(0.5)
10331
+ left_click
10332
+ sleep(1)
10333
+ @driver.switch_to.window(@driver.window_handle) #핸들 주입
10334
+ @driver.action.context_click(el).perform #우 클릭
10335
+ sleep(1)
10336
+ @driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
10337
+ sleep(1)
10338
+ puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
10339
+ rescue
10340
+ begin
10341
+ @driver.switch_to.default_content()
10342
+ @driver.switch_to.frame(@driver.find_element(:xpath, '//iframe[contains(@src, "spamcode.php") and @name="spamcode"]'))
10343
+ el = @driver.find_element(:xpath, "//img[contains(@src, 'spamcode.php')]")
10344
+ puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
10345
+ puts '-[√] 캡챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
10346
+ puts '-[√] 캡챠 코드 code 20.......'.red
10347
+ sleep(1)
10348
+ @driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
10349
+ sleep(1)
10350
+ mouse_move_percentage(0.3,0.02)
10351
+ sleep(0.5)
10352
+ left_click
10353
+ sleep(1)
10354
+ #@driver.switch_to.window(@driver.window_handle) #핸들 주입
10355
+ @driver.action.context_click(el).perform #우 클릭
10356
+ sleep(1)
10357
+ @driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
10358
+ sleep(1)
10359
+ puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
10360
+ #아이프레임 나오기
10361
+ @driver.switch_to.default_content()
10362
+ rescue
10363
+
10364
+ end
10365
+ end
10366
+ end
10221
10367
  end
10222
10368
 
10223
10369
  end
@@ -11179,7 +11325,175 @@ if check_captcha == 0
11179
11325
  puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11180
11326
  sleep(1)
11181
11327
  rescue
11328
+ begin
11329
+
11330
+ @driver.find_element(:xpath, '//*[@type="text" and @name="boardpwd"]').click
11331
+ sleep(1)
11332
+ el2 = @driver.find_element(:xpath, '//*[@type="text" and @name="boardpwd"]')
11333
+ @driver.action.context_click(el2).perform
11334
+
11335
+ sleep(1)
11336
+ @driver.action.key_stroke('up')
11337
+ sleep(1)
11338
+ @driver.action.key_stroke('up')
11339
+ sleep(1)
11340
+ @driver.action.key_stroke('enter')
11341
+ sleep(1)
11342
+ begin
11343
+ # 요소 찾기 타임아웃을 7초로 설정
11344
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11345
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11346
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11347
+ rescue
11348
+ sleep(1)
11349
+ @driver.action.key_stroke('left')
11350
+ sleep(1)
11351
+ @driver.action.key_stroke('up')
11352
+ sleep(1)
11353
+ @driver.action.key_stroke('enter')
11354
+ sleep(1)
11355
+ # 요소 찾기 타임아웃을 7초로 설정
11356
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11357
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11358
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11359
+ end
11360
+ puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
11361
+
11362
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11363
+ sleep(2)
11364
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11365
+ sleep(2)
11366
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11367
+ sleep(1)
11368
+ rescue
11369
+ begin
11370
+
11371
+ @driver.find_element(:xpath, '//*[@data-valid-title="보안문자"]').click
11372
+ sleep(1)
11373
+ el2 = @driver.find_element(:xpath, '//*[@data-valid-title="보안문자"]')
11374
+ @driver.action.context_click(el2).perform
11375
+
11376
+ sleep(1)
11377
+ @driver.action.key_stroke('up')
11378
+ sleep(1)
11379
+ @driver.action.key_stroke('up')
11380
+ sleep(1)
11381
+ @driver.action.key_stroke('enter')
11382
+ sleep(1)
11383
+ begin
11384
+ # 요소 찾기 타임아웃을 7초로 설정
11385
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11386
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11387
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11388
+ rescue
11389
+ sleep(1)
11390
+ @driver.action.key_stroke('left')
11391
+ sleep(1)
11392
+ @driver.action.key_stroke('up')
11393
+ sleep(1)
11394
+ @driver.action.key_stroke('enter')
11395
+ sleep(1)
11396
+ # 요소 찾기 타임아웃을 7초로 설정
11397
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11398
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11399
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11400
+ end
11401
+ puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
11402
+
11403
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11404
+ sleep(2)
11405
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11406
+ sleep(2)
11407
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11408
+ sleep(1)
11409
+ rescue
11410
+ begin
11182
11411
 
11412
+ @driver.find_element(:xpath, "//input[@type='text' and @name='spamcode_chk' and contains(@class, 'input_')]").click
11413
+ sleep(1)
11414
+ el2 = @driver.find_element(:xpath, "//input[@type='text' and @name='spamcode_chk' and contains(@class, 'input_')]")
11415
+ @driver.action.context_click(el2).perform
11416
+
11417
+ sleep(1)
11418
+ @driver.action.key_stroke('up')
11419
+ sleep(1)
11420
+ @driver.action.key_stroke('up')
11421
+ sleep(1)
11422
+ @driver.action.key_stroke('enter')
11423
+ sleep(1)
11424
+ begin
11425
+ # 요소 찾기 타임아웃을 7초로 설정
11426
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11427
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11428
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11429
+ rescue
11430
+ sleep(1)
11431
+ @driver.action.key_stroke('left')
11432
+ sleep(1)
11433
+ @driver.action.key_stroke('up')
11434
+ sleep(1)
11435
+ @driver.action.key_stroke('enter')
11436
+ sleep(1)
11437
+ # 요소 찾기 타임아웃을 7초로 설정
11438
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11439
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11440
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11441
+ end
11442
+ puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
11443
+
11444
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11445
+ sleep(2)
11446
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11447
+ sleep(2)
11448
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11449
+ sleep(1)
11450
+ rescue
11451
+ begin
11452
+
11453
+ @driver.find_element(:xpath, '//input[@class="input" and @title="보안문자"]').click
11454
+ sleep(1)
11455
+ el2 = @driver.find_element(:xpath, '//input[@class="input" and @title="보안문자"]')
11456
+ @driver.action.context_click(el2).perform
11457
+
11458
+ sleep(1)
11459
+ @driver.action.key_stroke('up')
11460
+ sleep(1)
11461
+ @driver.action.key_stroke('up')
11462
+ sleep(1)
11463
+ @driver.action.key_stroke('enter')
11464
+ sleep(1)
11465
+ begin
11466
+ # 요소 찾기 타임아웃을 7초로 설정
11467
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11468
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11469
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11470
+ rescue
11471
+ sleep(1)
11472
+ @driver.action.key_stroke('left')
11473
+ sleep(1)
11474
+ @driver.action.key_stroke('up')
11475
+ sleep(1)
11476
+ @driver.action.key_stroke('enter')
11477
+ sleep(1)
11478
+ # 요소 찾기 타임아웃을 7초로 설정
11479
+ wait = Selenium::WebDriver::Wait.new(:timeout => 7)
11480
+ #요소가 나타날 때까지 7초 동안 기다립니다.
11481
+ wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
11482
+ end
11483
+ puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
11484
+
11485
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11486
+ sleep(2)
11487
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11488
+ sleep(2)
11489
+ puts '-[√] 캡챠 해제 가능 유무 확인.......'.green
11490
+ sleep(1)
11491
+ rescue
11492
+
11493
+ end
11494
+ end
11495
+ end
11496
+ end
11183
11497
  end
11184
11498
  end
11185
11499
  end
@@ -11337,7 +11651,10 @@ sleep(1)
11337
11651
  @driver.action.key_down(:tab).key_up(:tab).perform #x탭
11338
11652
 
11339
11653
 
11340
-
11654
+ begin
11655
+ @driver.switch_to.default_content
11656
+ rescue
11657
+ end
11341
11658
 
11342
11659
 
11343
11660
 
@@ -11374,7 +11691,10 @@ rescue
11374
11691
  end
11375
11692
  end
11376
11693
 
11377
-
11694
+ begin
11695
+ @driver.switch_to.default_content
11696
+ rescue
11697
+ end
11378
11698
 
11379
11699
  ##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
11380
11700
 
@@ -11564,7 +11884,7 @@ sleep(1)
11564
11884
  @driver.find_element(:xpath, '//*[@form="write"]').click
11565
11885
  sleep(1)
11566
11886
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
11567
- puts '-[√] 등록을 19-1번 코드로 시도하였습니다.......'.magenta
11887
+ puts '-[√] 등록을 20번 코드로 시도하였습니다.......'.magenta
11568
11888
  sleep(1)
11569
11889
 
11570
11890
  rescue
@@ -11574,7 +11894,7 @@ ss_button = @driver.find_element(:partial_link_text, '저장하기')
11574
11894
  sleep(1)
11575
11895
 
11576
11896
  @driver.find_element(:partial_link_text, '저장하기').click #요소같고 텍스트가 다를때 텍스트로 타겟
11577
- puts '-[√] 등록을 20번 코드로 시도하였습니다.......'.magenta
11897
+ puts '-[√] 등록을 21번 코드로 시도하였습니다.......'.magenta
11578
11898
  sleep(1)
11579
11899
 
11580
11900
  rescue
@@ -11584,7 +11904,7 @@ ss_button = @driver.find_element(:xpath, '//*[@id="boardWriteForm"]/div/div[3]/a
11584
11904
  sleep(1)
11585
11905
 
11586
11906
  @driver.find_element(:xpath, '//*[@id="boardWriteForm"]/div/div[3]/a[2]').click
11587
- puts '-[√] 등록을 21시도하였습니다.......'.magenta
11907
+ puts '-[√] 등록을 22시도하였습니다.......'.magenta
11588
11908
  sleep(1)
11589
11909
 
11590
11910
  rescue
@@ -11594,7 +11914,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btnWrite"]')
11594
11914
  sleep(1)
11595
11915
 
11596
11916
  @driver.find_element(:xpath, '//*[@class="btnWrite"]').click
11597
- puts '-[√] 등록을 22시도하였습니다.......'.magenta
11917
+ puts '-[√] 등록을 23시도하였습니다.......'.magenta
11598
11918
  sleep(1)
11599
11919
 
11600
11920
  rescue
@@ -11604,7 +11924,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btn_blue btn_svc write"]')
11604
11924
  sleep(1)
11605
11925
 
11606
11926
  @driver.find_element(:xpath, '//*[@class="btn_blue btn_svc write"]').click
11607
- puts '-[√] 등록을 23번 코드로 시도하였습니다.......'.magenta
11927
+ puts '-[√] 등록을 24번 코드로 시도하였습니다.......'.magenta
11608
11928
  sleep(1)
11609
11929
 
11610
11930
  rescue
@@ -11618,7 +11938,7 @@ end
11618
11938
  sleep(1)
11619
11939
 
11620
11940
  ss_button.click
11621
- puts '-[√] 등록을 24번 코드로 시도하였습니다.......'.magenta
11941
+ puts '-[√] 등록을 25번 코드로 시도하였습니다.......'.magenta
11622
11942
  sleep(1)
11623
11943
 
11624
11944
 
@@ -11629,7 +11949,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="button-agree"]')
11629
11949
  sleep(1)
11630
11950
 
11631
11951
  @driver.find_element(:xpath, '//*[@class="button-agree"]').click
11632
- puts '-[√] 등록을 25번 코드로 시도하였습니다.......'.magenta
11952
+ puts '-[√] 등록을 26번 코드로 시도하였습니다.......'.magenta
11633
11953
  sleep(1)
11634
11954
 
11635
11955
  rescue
@@ -11639,7 +11959,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btnSubmitFix sizeM"]')
11639
11959
  sleep(1)
11640
11960
 
11641
11961
  @driver.find_element(:xpath, '//*[@class="btnSubmitFix sizeM"]').click
11642
- puts '-[√] 등록을 26번 코드로 시도하였습니다.......'.magenta
11962
+ puts '-[√] 등록을 27번 코드로 시도하였습니다.......'.magenta
11643
11963
  sleep(1)
11644
11964
 
11645
11965
  rescue
@@ -11649,7 +11969,7 @@ ss_button = @driver.find_element(:xpath, "//button[contains(text(), '글쓰기')
11649
11969
  sleep(1)
11650
11970
 
11651
11971
  @driver.find_element(:xpath, "//button[contains(text(), '글쓰기')]").click
11652
- puts '-[√] 등록을 27번 코드로 시도하였습니다.......'.magenta
11972
+ puts '-[√] 등록을 28번 코드로 시도하였습니다.......'.magenta
11653
11973
  sleep(1)
11654
11974
 
11655
11975
  rescue
@@ -11659,7 +11979,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="Button button-rounded blac
11659
11979
  sleep(1)
11660
11980
 
11661
11981
  @driver.find_element(:xpath, '//*[@class="Button button-rounded black button-normal"]').click
11662
- puts '-[√] 등록을 28번 코드로 시도하였습니다.......'.magenta
11982
+ puts '-[√] 등록을 29번 코드로 시도하였습니다.......'.magenta
11663
11983
  sleep(1)
11664
11984
 
11665
11985
  rescue
@@ -11669,7 +11989,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btn btn_point"]')
11669
11989
  sleep(1)
11670
11990
 
11671
11991
  @driver.find_element(:xpath, '//*[@class="btn btn_point"]').click
11672
- puts '-[√] 등록을 28번 코드로 시도하였습니다.......'.magenta
11992
+ puts '-[√] 등록을 30번 코드로 시도하였습니다.......'.magenta
11673
11993
  sleep(1)
11674
11994
 
11675
11995
  rescue
@@ -11679,7 +11999,7 @@ ss_button = @driver.find_element(:xpath, '//img[contains(@src, "save")]')
11679
11999
  sleep(1)
11680
12000
 
11681
12001
  ss_button = @driver.find_element(:xpath, '//img[contains(@src, "save")]').click
11682
- puts '-[√] 등록을 29번 코드로 시도하였습니다.......'.magenta
12002
+ puts '-[√] 등록을 31번 코드로 시도하였습니다.......'.magenta
11683
12003
  sleep(1)
11684
12004
 
11685
12005
  rescue
@@ -11689,7 +12009,7 @@ ss_button = @driver.find_element(:css, 'input[@type="submit" and @value="확인"
11689
12009
  sleep(1)
11690
12010
 
11691
12011
  ss_button = @driver.find_element(:css, 'input[@type="submit" and @value="확인"]').click
11692
- puts '-[√] 등록을 30번 코드로 시도하였습니다.......'.magenta
12012
+ puts '-[√] 등록을 32번 코드로 시도하였습니다.......'.magenta
11693
12013
  sleep(1)
11694
12014
 
11695
12015
  rescue
@@ -11699,7 +12019,7 @@ ss_button = @driver.find_element(:xpath, '//*[@type="button" and @value="작성"
11699
12019
  sleep(1)
11700
12020
 
11701
12021
  ss_button = @driver.find_element(:xpath, '//*[@type="button" and @value="작성"]').click
11702
- puts '-[√] 등록을 31번 코드로 시도하였습니다.......'.magenta
12022
+ puts '-[√] 등록을 33번 코드로 시도하였습니다.......'.magenta
11703
12023
  sleep(1)
11704
12024
 
11705
12025
  rescue
@@ -11709,7 +12029,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="button button-inverse butt
11709
12029
  sleep(1)
11710
12030
 
11711
12031
  ss_button = @driver.find_element(:xpath, '//*[@class="button button-inverse button-small write_ok"]').click
11712
- puts '-[√] 등록을 32번 코드로 시도하였습니다.......'.magenta
12032
+ puts '-[√] 등록을 34번 코드로 시도하였습니다.......'.magenta
11713
12033
  sleep(1)
11714
12034
 
11715
12035
  rescue
@@ -11719,7 +12039,7 @@ ss_button = @driver.find_element(:xpath, '//img[contains(@src, "btn/send")]')
11719
12039
  sleep(1)
11720
12040
 
11721
12041
  ss_button = @driver.find_element(:xpath, '//img[contains(@src, "btn/send")]').click
11722
- puts '-[√] 등록을 33번 코드로 시도하였습니다.......'.magenta
12042
+ puts '-[√] 등록을 35번 코드로 시도하였습니다.......'.magenta
11723
12043
  sleep(1)
11724
12044
 
11725
12045
  rescue
@@ -11729,7 +12049,7 @@ ss_button = @driver.find_element(:xpath, '//input[@name="formimage1"]')
11729
12049
  sleep(1)
11730
12050
 
11731
12051
  ss_button = @driver.find_element(:xpath, '//input[@name="formimage1"]').click
11732
- puts '-[√] 등록을 34번 코드로 시도하였습니다.......'.magenta
12052
+ puts '-[√] 등록을 36번 코드로 시도하였습니다.......'.magenta
11733
12053
  sleep(1)
11734
12054
 
11735
12055
  rescue
@@ -11739,7 +12059,7 @@ ss_button = @driver.find_element(:xpath, '//button[@type="button" and @class="bt
11739
12059
  sleep(1)
11740
12060
 
11741
12061
  ss_button = @driver.find_element(:xpath, '//button[@type="button" and @class="btnSubmit"]').click
11742
- puts '-[√] 등록을 35번 코드로 시도하였습니다.......'.magenta
12062
+ puts '-[√] 등록을 37번 코드로 시도하였습니다.......'.magenta
11743
12063
  sleep(1)
11744
12064
 
11745
12065
  rescue
@@ -11749,7 +12069,7 @@ ss_button = @driver.find_element(:xpath, '//input[@type="button" and @value="전
11749
12069
  sleep(1)
11750
12070
 
11751
12071
  ss_button = @driver.find_element(:xpath, '//input[@type="button" and @value="전송"]').click
11752
- puts '-[√] 등록을 36번 코드로 시도하였습니다.......'.magenta
12072
+ puts '-[√] 등록을 38번 코드로 시도하였습니다.......'.magenta
11753
12073
  sleep(1)
11754
12074
 
11755
12075
  rescue
@@ -11759,7 +12079,7 @@ ss_button = @driver.find_element(css: 'ul.bt_type li a.bt_type4_w_4')
11759
12079
  sleep(1)
11760
12080
 
11761
12081
  ss_button = @driver.find_element(css: 'ul.bt_type li a.bt_type4_w_4').click
11762
- puts '-[√] 등록을 36번 코드로 시도하였습니다.......'.magenta
12082
+ puts '-[√] 등록을 39번 코드로 시도하였습니다.......'.magenta
11763
12083
  sleep(1)
11764
12084
 
11765
12085
  rescue
@@ -11769,7 +12089,7 @@ ss_button = @driver.find_element(id: 'btn-write')
11769
12089
  sleep(1)
11770
12090
 
11771
12091
  ss_button = @driver.find_element(id: 'btn-write').click
11772
- puts '-[√] 등록을 37번 코드로 시도하였습니다.......'.magenta
12092
+ puts '-[√] 등록을 40번 코드로 시도하였습니다.......'.magenta
11773
12093
  sleep(1)
11774
12094
 
11775
12095
  rescue
@@ -11779,7 +12099,7 @@ ss_button = @driver.find_element(:xpath, '//img[contains(@src, "img/btn_confirm.
11779
12099
  sleep(1)
11780
12100
 
11781
12101
  ss_button = @driver.find_element(:xpath, '//img[contains(@src, "img/btn_confirm.gif")]').click
11782
- puts '-[√] 등록을 38번 코드로 시도하였습니다.......'.magenta
12102
+ puts '-[√] 등록을 41번 코드로 시도하였습니다.......'.magenta
11783
12103
  sleep(1)
11784
12104
 
11785
12105
  rescue
@@ -11789,7 +12109,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btn2_1"]')
11789
12109
  sleep(1)
11790
12110
 
11791
12111
  ss_button = @driver.find_element(:xpath, '//*[@class="btn2_1"]').click
11792
- puts '-[√] 등록을 39번 코드로 시도하였습니다.......'.magenta
12112
+ puts '-[√] 등록을 42번 코드로 시도하였습니다.......'.magenta
11793
12113
  sleep(1)
11794
12114
 
11795
12115
  rescue
@@ -11799,7 +12119,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="pro-btn large _write"]')
11799
12119
  sleep(1)
11800
12120
 
11801
12121
  ss_button = @driver.find_element(:xpath, '//*[@class="pro-btn large _write"]').click
11802
- puts '-[√] 등록을 39번 코드로 시도하였습니다.......'.magenta
12122
+ puts '-[√] 등록을 43번 코드로 시도하였습니다.......'.magenta
11803
12123
  sleep(1)
11804
12124
 
11805
12125
  rescue
@@ -11809,7 +12129,7 @@ ss_button = @driver.find_element(:xpath, '//*[@type="submit" and @name="save" an
11809
12129
  sleep(1)
11810
12130
 
11811
12131
  ss_button = @driver.find_element(:xpath, '//*[@type="submit" and @name="save" and @value="저장"]').click
11812
- puts '-[√] 등록을 40번 코드로 시도하였습니다.......'.magenta
12132
+ puts '-[√] 등록을 44번 코드로 시도하였습니다.......'.magenta
11813
12133
  sleep(1)
11814
12134
 
11815
12135
  rescue
@@ -11819,7 +12139,47 @@ ss_button = @driver.find_element(:xpath, '//a[text()="확인" and @href="javascr
11819
12139
  sleep(1)
11820
12140
 
11821
12141
  ss_button = @driver.find_element(:xpath, '//a[text()="확인" and @href="javascript:chk();"]').click
11822
- puts '-[√] 등록을 41번 코드로 시도하였습니다.......'.magenta
12142
+ puts '-[√] 등록을 45번 코드로 시도하였습니다.......'.magenta
12143
+ sleep(1)
12144
+
12145
+ rescue
12146
+ begin
12147
+ ss_button = @driver.find_element(:xpath, '//a[text()="저장" and contains(@class, "write_color_btn")]')
12148
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
12149
+ sleep(1)
12150
+
12151
+ ss_button = @driver.find_element(:xpath, '//a[text()="저장" and contains(@class, "write_color_btn")]').click
12152
+ puts '-[√] 등록을 46번 코드로 시도하였습니다.......'.magenta
12153
+ sleep(1)
12154
+
12155
+ rescue
12156
+ begin
12157
+ ss_button = @driver.find_element(:xpath, '//a[text()="저장" and contains(@class, "write_color_btn")]')
12158
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
12159
+ sleep(1)
12160
+
12161
+ ss_button = @driver.find_element(:xpath, '//button[text()[contains(., "등록")] and contains(@class, "b-btn-type01") and contains(@class, "b-btn-c-black")]').click
12162
+ puts '-[√] 등록을 47번 코드로 시도하였습니다.......'.magenta
12163
+ sleep(1)
12164
+
12165
+ rescue
12166
+ begin
12167
+ ss_button = @driver.find_element(:xpath, "//a[contains(@class, 'w2aDesign-color-btn1') and normalize-space(text())='등록']")
12168
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
12169
+ sleep(1)
12170
+
12171
+ ss_button = @driver.find_element(:xpath, "//a[contains(@class, 'w2aDesign-color-btn1') and normalize-space(text())='등록']").click
12172
+ puts '-[√] 등록을 48번 코드로 시도하였습니다.......'.magenta
12173
+ sleep(1)
12174
+
12175
+ rescue
12176
+ begin
12177
+ ss_button = @driver.find_element(:xpath, "//a[@onclick='spamChkForm()' and normalize-space(text())='저장하기']")
12178
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
12179
+ sleep(1)
12180
+
12181
+ ss_button = @driver.find_element(:xpath, "//a[@onclick='spamChkForm()' and normalize-space(text())='저장하기']").click
12182
+ puts '-[√] 등록을 49번 코드로 시도하였습니다.......'.magenta
11823
12183
  sleep(1)
11824
12184
 
11825
12185
  rescue
@@ -12008,6 +12368,8 @@ end
12008
12368
  end
12009
12369
  end
12010
12370
  end
12371
+ end
12372
+ end
12011
12373
  end
12012
12374
  end
12013
12375
  end
@@ -12026,6 +12388,8 @@ end
12026
12388
  end
12027
12389
  end
12028
12390
  end
12391
+ end
12392
+ end
12029
12393
  ########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 2차 시도 ▲▲▲▲▲▲▲──────────────────────────────#######
12030
12394
  end
12031
12395
  end
@@ -12069,6 +12433,89 @@ end
12069
12433
  end
12070
12434
  end
12071
12435
 
12436
+
12437
+ begin
12438
+ # 타임아웃을 3초로 설정
12439
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
12440
+ # 요소가 나타날 때까지 30초 동안 기다립니다.
12441
+ wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
12442
+ sleep(1)
12443
+ el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
12444
+ @driver.action.move_to(el_ready).perform
12445
+ sleep(1)
12446
+ begin
12447
+ @driver.execute_script(<<~JS)
12448
+ document.querySelectorAll('.captcha-solver[data-state="solved"]').forEach(el => el.remove());
12449
+ JS
12450
+
12451
+ puts "방해 캡차 관련 요소 제거 완료".green
12452
+ rescue
12453
+ end
12454
+ puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
12455
+ begin
12456
+ @driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
12457
+ rescue
12458
+ begin
12459
+ @driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
12460
+ rescue
12461
+ begin
12462
+ @driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
12463
+ rescue
12464
+ begin
12465
+ @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
12466
+ rescue
12467
+ end
12468
+ end
12469
+ end
12470
+ end
12471
+
12472
+ sleep(10)
12473
+ begin
12474
+ @driver.find_element(:xpath, '//*[@data-state="error"]').click
12475
+ puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
12476
+ puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
12477
+ @driver.window_handles.each do |handle|
12478
+ @driver.switch_to.window(handle)
12479
+ begin
12480
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
12481
+ @driver.close
12482
+ rescue Selenium::WebDriver::Error::WebDriverError => e
12483
+ puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
12484
+ end
12485
+ end
12486
+ #return 0
12487
+ @driver.quit
12488
+ sleep(1)
12489
+ return 0
12490
+ sleep(1)
12491
+ rescue
12492
+ wait = Selenium::WebDriver::Wait.new(timeout: 150)
12493
+
12494
+ begin
12495
+ wait.until do
12496
+ begin
12497
+ # data-state="solved" 요소가 있으면 true (대기 종료)
12498
+ @driver.find_element(:xpath, '//*[@data-state="solved"]')
12499
+ true
12500
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError
12501
+ # 페이지가 바뀌면 true (대기 종료)
12502
+ true
12503
+ rescue Selenium::WebDriver::Error::NoSuchElementError
12504
+ # 요소가 아직 없으면 false (계속 대기)
12505
+ false
12506
+ end
12507
+ end
12508
+ rescue Selenium::WebDriver::Error::TimeoutError
12509
+ # 150초 지나도 못 찾으면 여기로 넘어감
12510
+ end
12511
+
12512
+ puts '-[√] 캡챠 해제 완료 또는 페이지 변경 감지 → 이어서 진행 합니다.......'.green
12513
+ sleep(5)
12514
+
12515
+ end
12516
+ rescue
12517
+ end
12518
+
12072
12519
  ########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
12073
12520
  ########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
12074
12521