posting_zon 3.107.999 → 3.109.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.
- checksums.yaml +4 -4
- data/lib/posting_zon.rb +612 -207
- 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
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
document.
|
699
|
-
|
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
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
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
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
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
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
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
|
-
|
2013
|
-
@driver.execute_script
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
document.
|
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
|
-
|
3731
|
-
@driver.execute_script
|
3732
|
-
|
3733
|
-
|
3734
|
-
|
3735
|
-
document.
|
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
|
-
|
5181
|
-
#오른쪽 마우스 해제 코드
|
5157
|
+
sleep(1)
|
5182
5158
|
begin
|
5183
|
-
|
5184
|
-
|
5185
|
-
|
5186
|
-
|
5187
|
-
document.
|
5188
|
-
|
5189
|
-
|
5190
|
-
@driver.execute_script <<-JS
|
5191
|
-
document.addEventListener('contextmenu', function(e) {
|
5192
|
-
e.stopImmediatePropagation();
|
5193
|
-
}, true);
|
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;
|
5194
5165
|
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
|
-
|
5575
|
-
|
5576
|
-
|
5577
|
-
|
5578
|
-
document.
|
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;
|
5579
5548
|
JS
|
5580
|
-
|
5581
|
-
@driver.execute_script <<-JS
|
5582
|
-
document.addEventListener('contextmenu', function(e) {
|
5583
|
-
e.stopImmediatePropagation();
|
5584
|
-
}, true);
|
5585
|
-
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
|
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
|
-
|
8226
|
-
|
8227
|
-
|
8228
|
-
|
8229
|
-
|
8230
|
-
|
8231
|
-
</div>
|
8232
|
-
HTML
|
8233
|
-
@driver.execute_script("arguments[0].insertAdjacentHTML('afterend', arguments[1]);", target_element, checkbox_html)
|
8234
|
-
puts '체크박스 HTML 강제 적용.......'.green
|
8235
|
-
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)
|
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)
|
8240
8255
|
sleep(1)
|
8241
|
-
|
8242
|
-
|
8243
|
-
|
8244
|
-
puts '-[√] 임의 추가 HTML 코드 01 code.......'.yellow
|
8256
|
+
@driver.find_element(:xpath, '//*[@data-button-id="html"]').click
|
8257
|
+
@driver.switch_to.default_content
|
8258
|
+
puts '-[√] HTML 코드 33 code.......'.yellow
|
8245
8259
|
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, '
|
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,133 @@ 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
|
+
|
11452
|
+
end
|
11453
|
+
end
|
11454
|
+
end
|
11183
11455
|
end
|
11184
11456
|
end
|
11185
11457
|
end
|
@@ -11337,7 +11609,10 @@ sleep(1)
|
|
11337
11609
|
@driver.action.key_down(:tab).key_up(:tab).perform #x탭
|
11338
11610
|
|
11339
11611
|
|
11340
|
-
|
11612
|
+
begin
|
11613
|
+
@driver.switch_to.default_content
|
11614
|
+
rescue
|
11615
|
+
end
|
11341
11616
|
|
11342
11617
|
|
11343
11618
|
|
@@ -11374,7 +11649,10 @@ rescue
|
|
11374
11649
|
end
|
11375
11650
|
end
|
11376
11651
|
|
11377
|
-
|
11652
|
+
begin
|
11653
|
+
@driver.switch_to.default_content
|
11654
|
+
rescue
|
11655
|
+
end
|
11378
11656
|
|
11379
11657
|
##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
|
11380
11658
|
|
@@ -11564,7 +11842,7 @@ sleep(1)
|
|
11564
11842
|
@driver.find_element(:xpath, '//*[@form="write"]').click
|
11565
11843
|
sleep(1)
|
11566
11844
|
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
11567
|
-
puts '-[√] 등록을
|
11845
|
+
puts '-[√] 등록을 20번 코드로 시도하였습니다.......'.magenta
|
11568
11846
|
sleep(1)
|
11569
11847
|
|
11570
11848
|
rescue
|
@@ -11574,7 +11852,7 @@ ss_button = @driver.find_element(:partial_link_text, '저장하기')
|
|
11574
11852
|
sleep(1)
|
11575
11853
|
|
11576
11854
|
@driver.find_element(:partial_link_text, '저장하기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
11577
|
-
puts '-[√] 등록을
|
11855
|
+
puts '-[√] 등록을 21번 코드로 시도하였습니다.......'.magenta
|
11578
11856
|
sleep(1)
|
11579
11857
|
|
11580
11858
|
rescue
|
@@ -11584,7 +11862,7 @@ ss_button = @driver.find_element(:xpath, '//*[@id="boardWriteForm"]/div/div[3]/a
|
|
11584
11862
|
sleep(1)
|
11585
11863
|
|
11586
11864
|
@driver.find_element(:xpath, '//*[@id="boardWriteForm"]/div/div[3]/a[2]').click
|
11587
|
-
puts '-[√] 등록을
|
11865
|
+
puts '-[√] 등록을 22시도하였습니다.......'.magenta
|
11588
11866
|
sleep(1)
|
11589
11867
|
|
11590
11868
|
rescue
|
@@ -11594,7 +11872,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btnWrite"]')
|
|
11594
11872
|
sleep(1)
|
11595
11873
|
|
11596
11874
|
@driver.find_element(:xpath, '//*[@class="btnWrite"]').click
|
11597
|
-
puts '-[√] 등록을
|
11875
|
+
puts '-[√] 등록을 23시도하였습니다.......'.magenta
|
11598
11876
|
sleep(1)
|
11599
11877
|
|
11600
11878
|
rescue
|
@@ -11604,7 +11882,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btn_blue btn_svc write"]')
|
|
11604
11882
|
sleep(1)
|
11605
11883
|
|
11606
11884
|
@driver.find_element(:xpath, '//*[@class="btn_blue btn_svc write"]').click
|
11607
|
-
puts '-[√] 등록을
|
11885
|
+
puts '-[√] 등록을 24번 코드로 시도하였습니다.......'.magenta
|
11608
11886
|
sleep(1)
|
11609
11887
|
|
11610
11888
|
rescue
|
@@ -11618,7 +11896,7 @@ end
|
|
11618
11896
|
sleep(1)
|
11619
11897
|
|
11620
11898
|
ss_button.click
|
11621
|
-
puts '-[√] 등록을
|
11899
|
+
puts '-[√] 등록을 25번 코드로 시도하였습니다.......'.magenta
|
11622
11900
|
sleep(1)
|
11623
11901
|
|
11624
11902
|
|
@@ -11629,7 +11907,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="button-agree"]')
|
|
11629
11907
|
sleep(1)
|
11630
11908
|
|
11631
11909
|
@driver.find_element(:xpath, '//*[@class="button-agree"]').click
|
11632
|
-
puts '-[√] 등록을
|
11910
|
+
puts '-[√] 등록을 26번 코드로 시도하였습니다.......'.magenta
|
11633
11911
|
sleep(1)
|
11634
11912
|
|
11635
11913
|
rescue
|
@@ -11639,7 +11917,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btnSubmitFix sizeM"]')
|
|
11639
11917
|
sleep(1)
|
11640
11918
|
|
11641
11919
|
@driver.find_element(:xpath, '//*[@class="btnSubmitFix sizeM"]').click
|
11642
|
-
puts '-[√] 등록을
|
11920
|
+
puts '-[√] 등록을 27번 코드로 시도하였습니다.......'.magenta
|
11643
11921
|
sleep(1)
|
11644
11922
|
|
11645
11923
|
rescue
|
@@ -11649,7 +11927,7 @@ ss_button = @driver.find_element(:xpath, "//button[contains(text(), '글쓰기')
|
|
11649
11927
|
sleep(1)
|
11650
11928
|
|
11651
11929
|
@driver.find_element(:xpath, "//button[contains(text(), '글쓰기')]").click
|
11652
|
-
puts '-[√] 등록을
|
11930
|
+
puts '-[√] 등록을 28번 코드로 시도하였습니다.......'.magenta
|
11653
11931
|
sleep(1)
|
11654
11932
|
|
11655
11933
|
rescue
|
@@ -11659,7 +11937,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="Button button-rounded blac
|
|
11659
11937
|
sleep(1)
|
11660
11938
|
|
11661
11939
|
@driver.find_element(:xpath, '//*[@class="Button button-rounded black button-normal"]').click
|
11662
|
-
puts '-[√] 등록을
|
11940
|
+
puts '-[√] 등록을 29번 코드로 시도하였습니다.......'.magenta
|
11663
11941
|
sleep(1)
|
11664
11942
|
|
11665
11943
|
rescue
|
@@ -11669,7 +11947,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btn btn_point"]')
|
|
11669
11947
|
sleep(1)
|
11670
11948
|
|
11671
11949
|
@driver.find_element(:xpath, '//*[@class="btn btn_point"]').click
|
11672
|
-
puts '-[√] 등록을
|
11950
|
+
puts '-[√] 등록을 30번 코드로 시도하였습니다.......'.magenta
|
11673
11951
|
sleep(1)
|
11674
11952
|
|
11675
11953
|
rescue
|
@@ -11679,7 +11957,7 @@ ss_button = @driver.find_element(:xpath, '//img[contains(@src, "save")]')
|
|
11679
11957
|
sleep(1)
|
11680
11958
|
|
11681
11959
|
ss_button = @driver.find_element(:xpath, '//img[contains(@src, "save")]').click
|
11682
|
-
puts '-[√] 등록을
|
11960
|
+
puts '-[√] 등록을 31번 코드로 시도하였습니다.......'.magenta
|
11683
11961
|
sleep(1)
|
11684
11962
|
|
11685
11963
|
rescue
|
@@ -11689,7 +11967,7 @@ ss_button = @driver.find_element(:css, 'input[@type="submit" and @value="확인"
|
|
11689
11967
|
sleep(1)
|
11690
11968
|
|
11691
11969
|
ss_button = @driver.find_element(:css, 'input[@type="submit" and @value="확인"]').click
|
11692
|
-
puts '-[√] 등록을
|
11970
|
+
puts '-[√] 등록을 32번 코드로 시도하였습니다.......'.magenta
|
11693
11971
|
sleep(1)
|
11694
11972
|
|
11695
11973
|
rescue
|
@@ -11699,7 +11977,7 @@ ss_button = @driver.find_element(:xpath, '//*[@type="button" and @value="작성"
|
|
11699
11977
|
sleep(1)
|
11700
11978
|
|
11701
11979
|
ss_button = @driver.find_element(:xpath, '//*[@type="button" and @value="작성"]').click
|
11702
|
-
puts '-[√] 등록을
|
11980
|
+
puts '-[√] 등록을 33번 코드로 시도하였습니다.......'.magenta
|
11703
11981
|
sleep(1)
|
11704
11982
|
|
11705
11983
|
rescue
|
@@ -11709,7 +11987,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="button button-inverse butt
|
|
11709
11987
|
sleep(1)
|
11710
11988
|
|
11711
11989
|
ss_button = @driver.find_element(:xpath, '//*[@class="button button-inverse button-small write_ok"]').click
|
11712
|
-
puts '-[√] 등록을
|
11990
|
+
puts '-[√] 등록을 34번 코드로 시도하였습니다.......'.magenta
|
11713
11991
|
sleep(1)
|
11714
11992
|
|
11715
11993
|
rescue
|
@@ -11719,7 +11997,7 @@ ss_button = @driver.find_element(:xpath, '//img[contains(@src, "btn/send")]')
|
|
11719
11997
|
sleep(1)
|
11720
11998
|
|
11721
11999
|
ss_button = @driver.find_element(:xpath, '//img[contains(@src, "btn/send")]').click
|
11722
|
-
puts '-[√] 등록을
|
12000
|
+
puts '-[√] 등록을 35번 코드로 시도하였습니다.......'.magenta
|
11723
12001
|
sleep(1)
|
11724
12002
|
|
11725
12003
|
rescue
|
@@ -11729,7 +12007,7 @@ ss_button = @driver.find_element(:xpath, '//input[@name="formimage1"]')
|
|
11729
12007
|
sleep(1)
|
11730
12008
|
|
11731
12009
|
ss_button = @driver.find_element(:xpath, '//input[@name="formimage1"]').click
|
11732
|
-
puts '-[√] 등록을
|
12010
|
+
puts '-[√] 등록을 36번 코드로 시도하였습니다.......'.magenta
|
11733
12011
|
sleep(1)
|
11734
12012
|
|
11735
12013
|
rescue
|
@@ -11739,7 +12017,7 @@ ss_button = @driver.find_element(:xpath, '//button[@type="button" and @class="bt
|
|
11739
12017
|
sleep(1)
|
11740
12018
|
|
11741
12019
|
ss_button = @driver.find_element(:xpath, '//button[@type="button" and @class="btnSubmit"]').click
|
11742
|
-
puts '-[√] 등록을
|
12020
|
+
puts '-[√] 등록을 37번 코드로 시도하였습니다.......'.magenta
|
11743
12021
|
sleep(1)
|
11744
12022
|
|
11745
12023
|
rescue
|
@@ -11749,7 +12027,7 @@ ss_button = @driver.find_element(:xpath, '//input[@type="button" and @value="전
|
|
11749
12027
|
sleep(1)
|
11750
12028
|
|
11751
12029
|
ss_button = @driver.find_element(:xpath, '//input[@type="button" and @value="전송"]').click
|
11752
|
-
puts '-[√] 등록을
|
12030
|
+
puts '-[√] 등록을 38번 코드로 시도하였습니다.......'.magenta
|
11753
12031
|
sleep(1)
|
11754
12032
|
|
11755
12033
|
rescue
|
@@ -11759,7 +12037,7 @@ ss_button = @driver.find_element(css: 'ul.bt_type li a.bt_type4_w_4')
|
|
11759
12037
|
sleep(1)
|
11760
12038
|
|
11761
12039
|
ss_button = @driver.find_element(css: 'ul.bt_type li a.bt_type4_w_4').click
|
11762
|
-
puts '-[√] 등록을
|
12040
|
+
puts '-[√] 등록을 39번 코드로 시도하였습니다.......'.magenta
|
11763
12041
|
sleep(1)
|
11764
12042
|
|
11765
12043
|
rescue
|
@@ -11769,7 +12047,7 @@ ss_button = @driver.find_element(id: 'btn-write')
|
|
11769
12047
|
sleep(1)
|
11770
12048
|
|
11771
12049
|
ss_button = @driver.find_element(id: 'btn-write').click
|
11772
|
-
puts '-[√] 등록을
|
12050
|
+
puts '-[√] 등록을 40번 코드로 시도하였습니다.......'.magenta
|
11773
12051
|
sleep(1)
|
11774
12052
|
|
11775
12053
|
rescue
|
@@ -11779,7 +12057,7 @@ ss_button = @driver.find_element(:xpath, '//img[contains(@src, "img/btn_confirm.
|
|
11779
12057
|
sleep(1)
|
11780
12058
|
|
11781
12059
|
ss_button = @driver.find_element(:xpath, '//img[contains(@src, "img/btn_confirm.gif")]').click
|
11782
|
-
puts '-[√] 등록을
|
12060
|
+
puts '-[√] 등록을 41번 코드로 시도하였습니다.......'.magenta
|
11783
12061
|
sleep(1)
|
11784
12062
|
|
11785
12063
|
rescue
|
@@ -11789,7 +12067,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="btn2_1"]')
|
|
11789
12067
|
sleep(1)
|
11790
12068
|
|
11791
12069
|
ss_button = @driver.find_element(:xpath, '//*[@class="btn2_1"]').click
|
11792
|
-
puts '-[√] 등록을
|
12070
|
+
puts '-[√] 등록을 42번 코드로 시도하였습니다.......'.magenta
|
11793
12071
|
sleep(1)
|
11794
12072
|
|
11795
12073
|
rescue
|
@@ -11799,7 +12077,7 @@ ss_button = @driver.find_element(:xpath, '//*[@class="pro-btn large _write"]')
|
|
11799
12077
|
sleep(1)
|
11800
12078
|
|
11801
12079
|
ss_button = @driver.find_element(:xpath, '//*[@class="pro-btn large _write"]').click
|
11802
|
-
puts '-[√] 등록을
|
12080
|
+
puts '-[√] 등록을 43번 코드로 시도하였습니다.......'.magenta
|
11803
12081
|
sleep(1)
|
11804
12082
|
|
11805
12083
|
rescue
|
@@ -11809,7 +12087,7 @@ ss_button = @driver.find_element(:xpath, '//*[@type="submit" and @name="save" an
|
|
11809
12087
|
sleep(1)
|
11810
12088
|
|
11811
12089
|
ss_button = @driver.find_element(:xpath, '//*[@type="submit" and @name="save" and @value="저장"]').click
|
11812
|
-
puts '-[√] 등록을
|
12090
|
+
puts '-[√] 등록을 44번 코드로 시도하였습니다.......'.magenta
|
11813
12091
|
sleep(1)
|
11814
12092
|
|
11815
12093
|
rescue
|
@@ -11819,7 +12097,47 @@ ss_button = @driver.find_element(:xpath, '//a[text()="확인" and @href="javascr
|
|
11819
12097
|
sleep(1)
|
11820
12098
|
|
11821
12099
|
ss_button = @driver.find_element(:xpath, '//a[text()="확인" and @href="javascript:chk();"]').click
|
11822
|
-
puts '-[√] 등록을
|
12100
|
+
puts '-[√] 등록을 45번 코드로 시도하였습니다.......'.magenta
|
12101
|
+
sleep(1)
|
12102
|
+
|
12103
|
+
rescue
|
12104
|
+
begin
|
12105
|
+
ss_button = @driver.find_element(:xpath, '//a[text()="저장" and contains(@class, "write_color_btn")]')
|
12106
|
+
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
|
12107
|
+
sleep(1)
|
12108
|
+
|
12109
|
+
ss_button = @driver.find_element(:xpath, '//a[text()="저장" and contains(@class, "write_color_btn")]').click
|
12110
|
+
puts '-[√] 등록을 46번 코드로 시도하였습니다.......'.magenta
|
12111
|
+
sleep(1)
|
12112
|
+
|
12113
|
+
rescue
|
12114
|
+
begin
|
12115
|
+
ss_button = @driver.find_element(:xpath, '//a[text()="저장" and contains(@class, "write_color_btn")]')
|
12116
|
+
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
|
12117
|
+
sleep(1)
|
12118
|
+
|
12119
|
+
ss_button = @driver.find_element(:xpath, '//button[text()[contains(., "등록")] and contains(@class, "b-btn-type01") and contains(@class, "b-btn-c-black")]').click
|
12120
|
+
puts '-[√] 등록을 47번 코드로 시도하였습니다.......'.magenta
|
12121
|
+
sleep(1)
|
12122
|
+
|
12123
|
+
rescue
|
12124
|
+
begin
|
12125
|
+
ss_button = @driver.find_element(:xpath, "//a[contains(@class, 'w2aDesign-color-btn1') and normalize-space(text())='등록']")
|
12126
|
+
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
|
12127
|
+
sleep(1)
|
12128
|
+
|
12129
|
+
ss_button = @driver.find_element(:xpath, "//a[contains(@class, 'w2aDesign-color-btn1') and normalize-space(text())='등록']").click
|
12130
|
+
puts '-[√] 등록을 48번 코드로 시도하였습니다.......'.magenta
|
12131
|
+
sleep(1)
|
12132
|
+
|
12133
|
+
rescue
|
12134
|
+
begin
|
12135
|
+
ss_button = @driver.find_element(:xpath, "//a[@onclick='spamChkForm()' and normalize-space(text())='저장하기']")
|
12136
|
+
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
|
12137
|
+
sleep(1)
|
12138
|
+
|
12139
|
+
ss_button = @driver.find_element(:xpath, "//a[@onclick='spamChkForm()' and normalize-space(text())='저장하기']").click
|
12140
|
+
puts '-[√] 등록을 49번 코드로 시도하였습니다.......'.magenta
|
11823
12141
|
sleep(1)
|
11824
12142
|
|
11825
12143
|
rescue
|
@@ -12008,6 +12326,8 @@ end
|
|
12008
12326
|
end
|
12009
12327
|
end
|
12010
12328
|
end
|
12329
|
+
end
|
12330
|
+
end
|
12011
12331
|
end
|
12012
12332
|
end
|
12013
12333
|
end
|
@@ -12026,6 +12346,8 @@ end
|
|
12026
12346
|
end
|
12027
12347
|
end
|
12028
12348
|
end
|
12349
|
+
end
|
12350
|
+
end
|
12029
12351
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 2차 시도 ▲▲▲▲▲▲▲──────────────────────────────#######
|
12030
12352
|
end
|
12031
12353
|
end
|
@@ -12069,6 +12391,89 @@ end
|
|
12069
12391
|
end
|
12070
12392
|
end
|
12071
12393
|
|
12394
|
+
|
12395
|
+
begin
|
12396
|
+
# 타임아웃을 3초로 설정
|
12397
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
12398
|
+
# 요소가 나타날 때까지 30초 동안 기다립니다.
|
12399
|
+
wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
|
12400
|
+
sleep(1)
|
12401
|
+
el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
|
12402
|
+
@driver.action.move_to(el_ready).perform
|
12403
|
+
sleep(1)
|
12404
|
+
begin
|
12405
|
+
@driver.execute_script(<<~JS)
|
12406
|
+
document.querySelectorAll('.captcha-solver[data-state="solved"]').forEach(el => el.remove());
|
12407
|
+
JS
|
12408
|
+
|
12409
|
+
puts "방해 캡차 관련 요소 제거 완료".green
|
12410
|
+
rescue
|
12411
|
+
end
|
12412
|
+
puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
|
12413
|
+
begin
|
12414
|
+
@driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
|
12415
|
+
rescue
|
12416
|
+
begin
|
12417
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
|
12418
|
+
rescue
|
12419
|
+
begin
|
12420
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
|
12421
|
+
rescue
|
12422
|
+
begin
|
12423
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
|
12424
|
+
rescue
|
12425
|
+
end
|
12426
|
+
end
|
12427
|
+
end
|
12428
|
+
end
|
12429
|
+
|
12430
|
+
sleep(10)
|
12431
|
+
begin
|
12432
|
+
@driver.find_element(:xpath, '//*[@data-state="error"]').click
|
12433
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12434
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
12435
|
+
@driver.window_handles.each do |handle|
|
12436
|
+
@driver.switch_to.window(handle)
|
12437
|
+
begin
|
12438
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
12439
|
+
@driver.close
|
12440
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
12441
|
+
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
12442
|
+
end
|
12443
|
+
end
|
12444
|
+
#return 0
|
12445
|
+
@driver.quit
|
12446
|
+
sleep(1)
|
12447
|
+
return 0
|
12448
|
+
sleep(1)
|
12449
|
+
rescue
|
12450
|
+
wait = Selenium::WebDriver::Wait.new(timeout: 150)
|
12451
|
+
|
12452
|
+
begin
|
12453
|
+
wait.until do
|
12454
|
+
begin
|
12455
|
+
# data-state="solved" 요소가 있으면 true (대기 종료)
|
12456
|
+
@driver.find_element(:xpath, '//*[@data-state="solved"]')
|
12457
|
+
true
|
12458
|
+
rescue Selenium::WebDriver::Error::StaleElementReferenceError
|
12459
|
+
# 페이지가 바뀌면 true (대기 종료)
|
12460
|
+
true
|
12461
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
12462
|
+
# 요소가 아직 없으면 false (계속 대기)
|
12463
|
+
false
|
12464
|
+
end
|
12465
|
+
end
|
12466
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
12467
|
+
# 150초 지나도 못 찾으면 여기로 넘어감
|
12468
|
+
end
|
12469
|
+
|
12470
|
+
puts '-[√] 캡챠 해제 완료 또는 페이지 변경 감지 → 이어서 진행 합니다.......'.green
|
12471
|
+
sleep(5)
|
12472
|
+
|
12473
|
+
end
|
12474
|
+
rescue
|
12475
|
+
end
|
12476
|
+
|
12072
12477
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
|
12073
12478
|
########─────────────────────────────▲▲▲▲▲▲▲ 등록버튼 ▲▲▲▲▲▲▲──────────────────────────────#######
|
12074
12479
|
|