posting_duo 0.0.30 → 0.0.31

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_duo.rb +267 -147
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20979e15cb7508d97f1b65bacb6853dcf27d12b9828e17923c6bf2340bc014de
4
- data.tar.gz: dc3af1b58592d9c8db350887607733c678ec1d4508abc74a8509e697cedf03ff
3
+ metadata.gz: c7c5df42fb3e878235ff74eb1f4e8d0c0c24d3836db7c5eaab19e6450e7b344f
4
+ data.tar.gz: a1dcfe5c0e5d7407e3c480339367d6c6797f4b4d58e0bda5a08c5876bf83af1c
5
5
  SHA512:
6
- metadata.gz: daf48151576f6c7db028829d8df02b28473d060e4304a49b7819afcc7b36055c0b0029ddd2388afd980bc964133a08d782087dbfbf1525595209cb17c54ec48d
7
- data.tar.gz: fd4f709c4f510d6e18caff42cf6885e86df0715225ff9b8d2f3f485f83cf7231bd68e419503bf9abb184e93eec5bbba2c3c70fddec27978edcfdf40bdba1d871
6
+ metadata.gz: 5f33e76076e39df16bf1300e593e98d8b829cd6f48136e868000d86f2502697cdd9739363de28091d50fbe79d99bbfff277fa0657ca0eb95b12ceabb52204c2f
7
+ data.tar.gz: 5e46e0514553d863ec455c425b2999a22cc575b3e4c0cdcc5183c12a6a87a7782eb499968140cd08e738bf2b6f9126c4cb1db14d07d52fb381f381fb70c59763
data/lib/posting_duo.rb CHANGED
@@ -25,41 +25,39 @@ require 'watir'
25
25
 
26
26
 
27
27
 
28
- #driver.find_element(:class, 'highlight-java')
29
- # or
30
- #driver.find_element(:class_name, 'highlight-java')
31
-
32
28
  class Naver
33
29
 
34
30
  def chrome_start(proxy)
35
31
  if proxy == ''
36
- begin
32
+ begin
37
33
  Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
38
- options = Selenium::WebDriver::Chrome::Options.new #(options: {"excludeSwitches" => ["enable-automation"]}) #자동화된 테스트...제거(options: {"excludeSwitches" => ["enable-automation"]})
34
+ options = Selenium::WebDriver::Chrome::Options.new
39
35
  options.add_extension('./crx/free.crx')
40
36
  options.add_extension('./crx/app.crx')
41
37
  options.page_load_strategy = :normal
42
- options.timeouts = {page_load: 20_000}
38
+ options.timeouts = { page_load: 20_000 }
43
39
  options.add_argument('--disable-gpu')
44
40
  options.add_argument('--start-maximized')
45
41
  options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
46
- options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
47
-
42
+ options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능 비활성화
48
43
  options.add_argument('--disable-web-security') # 웹 보안 비활성화
49
44
  options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
50
45
  options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
51
-
52
46
  options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
53
47
  options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
54
48
  options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
55
49
  options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
56
50
  options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
57
-
58
-
51
+
52
+ # JavaScript로 navigator.webdriver 숨기기
53
+ options.add_argument('--disable-blink-features=AutomationControlled')
59
54
 
60
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
55
+ # Selenium webdriver 인식을 숨기는 JavaScript 코드 삽입
56
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
57
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
58
+
61
59
  rescue
62
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
60
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
63
61
  end
64
62
  else
65
63
  begin
@@ -72,25 +70,27 @@ class Naver
72
70
  options.add_extension('./crx/free.crx')
73
71
  options.add_extension('./crx/app.crx')
74
72
  options.page_load_strategy = :normal
75
- options.timeouts = {page_load: 20_000}
73
+ options.timeouts = { page_load: 20_000 }
76
74
  options.add_argument('--disable-gpu')
77
75
  options.add_argument('--start-maximized')
78
76
  options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
79
- options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
80
-
77
+ options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능 비활성화
81
78
  options.add_argument('--disable-web-security') # 웹 보안 비활성화
82
79
  options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
83
80
  options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
84
-
85
81
  options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
86
82
  options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
87
83
  options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
88
84
  options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
89
85
  options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
90
-
86
+
87
+ # JavaScript로 navigator.webdriver 숨기기
88
+ options.add_argument('--disable-blink-features=AutomationControlled')
91
89
 
92
-
93
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
90
+ # Selenium의 webdriver 인식을 숨기는 JavaScript 코드 삽입
91
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
92
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
93
+
94
94
  rescue => e
95
95
  puts e
96
96
  puts 'proxy error...'
@@ -99,50 +99,48 @@ class Naver
99
99
  options.add_extension('./crx/free.crx')
100
100
  options.add_extension('./crx/app.crx')
101
101
  options.page_load_strategy = :normal
102
- options.timeouts = {page_load: 20_000}
102
+ options.timeouts = { page_load: 20_000 }
103
103
  options.add_argument('--disable-gpu')
104
104
  options.add_argument('--start-maximized')
105
105
  options.add_argument('user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.59 Safari/537.36') # user-agent 위조
106
- options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
107
-
106
+ options.add_argument('--disable-blink-features=AutomationControlled') # 자동화된 환경에서 실행되는 것을 감지하는 기능 비활성화
108
107
  options.add_argument('--disable-web-security') # 웹 보안 비활성화
109
108
  options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
110
109
  options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
111
-
112
110
  options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
113
111
  options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
114
112
  options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
115
113
  options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
116
114
  options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
117
-
118
-
119
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
115
+
116
+ # JavaScript로 navigator.webdriver 숨기기
117
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
118
+ @driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
119
+
120
120
  rescue
121
- @driver = Selenium::WebDriver.for(:chrome, capabilities: options)
121
+ @driver = Selenium::WebDriver.for(:chrome, options: options)
122
122
  end
123
123
  end
124
124
  end
125
125
  end
126
126
 
127
127
 
128
-
128
+
129
129
  def login(proxy)
130
130
  chrome_start(proxy)
131
131
 
132
-
133
132
  @driver.get('chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html')
134
133
  sleep(1)
135
- begin
136
- @driver.switch_to.window(@driver.window_handles[1])
137
- sleep(1)
134
+ if @driver.window_handles.size > 1
135
+ @driver.switch_to.window(@driver.window_handles.last)
138
136
  @driver.close
139
- rescue
140
- @driver.switch_to.window(@driver.window_handles[0])
141
- end
137
+ @driver.switch_to.window(@driver.window_handles.first)
138
+ else
139
+ end
142
140
  sleep(1)
143
141
  end
144
142
 
145
- sleep(1)
143
+
146
144
 
147
145
  def update(user_id, user_pw, title, content, option, post_url, signup_url, login_url, cc_check_url, image_url_cheng, img_link2, category, more_txt1, more_txt2, more_txt3, more_txt4, captcha_key, keyword)
148
146
  puts 'start...'.yellow
@@ -3815,7 +3813,7 @@ post_url = option['post_url'].to_s
3815
3813
  begin
3816
3814
  puts '-[√] 글쓰기 버튼 클릭이 필수인지 탐색합니다.......'.green
3817
3815
  el_post_btn = @driver.find_element(:xpath, '//*[@class="btn btn-primary btn-sm float_r"]')
3818
- @driver.action.move_to(el_post_btn).perform
3816
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
3819
3817
  sleep(1)
3820
3818
  @driver.find_element(:xpath, '//*[@class="btn btn-primary btn-sm float_r"]').click
3821
3819
  sleep(3.7)
@@ -3823,7 +3821,7 @@ post_url = option['post_url'].to_s
3823
3821
  rescue
3824
3822
  begin
3825
3823
  el_post_btn = @driver.find_element(:xpath, '//*[@class="btn-block-right"]')
3826
- @driver.action.move_to(el_post_btn).perform
3824
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
3827
3825
  sleep(1)
3828
3826
  @driver.find_element(:xpath, '//*[@class="btn-block-right"]').click
3829
3827
  puts '-[√] 글쓰기 버튼 code 2.......'.green
@@ -3831,7 +3829,7 @@ post_url = option['post_url'].to_s
3831
3829
  rescue
3832
3830
  begin
3833
3831
  el_post_btn = @driver.find_element(:xpath, '//*[@class="write_btn"]')
3834
- @driver.action.move_to(el_post_btn).perform
3832
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
3835
3833
  sleep(1)
3836
3834
  @driver.find_element(:xpath, '//*[@class="write_btn"]').click
3837
3835
  puts '-[√] 글쓰기 버튼 code 3.......'.green
@@ -5486,16 +5484,23 @@ begin
5486
5484
  sleep(1)
5487
5485
  puts '-[√] 제목 code 37.......'.yellow
5488
5486
 
5487
+
5489
5488
  rescue => e
5490
-
5491
5489
  puts '-[√] 제목 입력 항목 코드 탐색 실패!!.......'.red
5492
5490
  puts '-[√] 다음 작업 준비 중으로 1~60 초 정도 기다려주세요.......'.red
5493
- puts e
5494
- @driver.close
5495
- return 0
5491
+
5492
+ @driver.window_handles.each do |handle|
5493
+ @driver.switch_to.window(handle)
5494
+ begin
5495
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
5496
+ @driver.close
5496
5497
 
5497
-
5498
- end
5498
+ rescue Selenium::WebDriver::Error::WebDriverError => e
5499
+ puts "Failed to close tab: #{e.message}"
5500
+ end
5501
+ end
5502
+ return 0
5503
+ end
5499
5504
 
5500
5505
  end
5501
5506
 
@@ -5548,125 +5553,179 @@ begin
5548
5553
  #아이프레임에서 코드 선택
5549
5554
  @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@scrolling="no"]'))
5550
5555
 
5556
+ html_bb = @driver.find_element(:xpath, '//*[@class="se2_to_html"]')
5557
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5558
+ #아이프레임 나오기
5559
+ sleep(1)
5551
5560
  @driver.find_element(:xpath, '//*[@class="se2_to_html"]').click
5552
- #아이프레임 나오기
5553
5561
  @driver.switch_to.default_content()
5554
5562
  puts '-[√] HTML 코드 1 code.......'.yellow
5563
+ sleep(1)
5555
5564
  rescue
5556
5565
  begin
5557
5566
 
5558
- @driver.find_element(:xpath, '//*[@title="HTML 편집"]').click
5567
+ html_bb = @driver.find_element(:xpath, '//*[@title="HTML 편집"]')
5568
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5559
5569
  puts '-[√] HTML 코드 2 code.......'.yellow
5560
-
5570
+ sleep(1)
5571
+ @driver.find_element(:xpath, '//*[@title="HTML 편집"]').click
5561
5572
  rescue
5562
5573
  begin
5563
5574
 
5564
- @driver.find_element(:xpath, '//*[@id="html"]').click
5575
+ html_bb = @driver.find_element(:xpath, '//*[@id="html"]')
5576
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5565
5577
  puts '-[√] HTML 코드 3 code.......'.yellow
5578
+ sleep(1)
5579
+ @driver.find_element(:xpath, '//*[@id="html"]').click
5566
5580
  rescue
5567
5581
  begin
5568
5582
 
5569
- @driver.find_element(:xpath, '//*[@title="코드보기"]').click
5583
+ html_bb = @driver.find_element(:xpath, '//*[@title="코드보기"]')
5584
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5570
5585
  puts '-[√] HTML 코드 4 code.......'.yellow
5586
+ sleep(1)
5587
+ @driver.find_element(:xpath, '//*[@title="코드보기"]').click
5571
5588
  rescue
5572
5589
  begin
5573
5590
 
5574
- @driver.find_element(:xpath, '//*[@id="chk_html"]').click
5591
+ html_bb = @driver.find_element(:xpath, '//*[@id="chk_html"]')
5592
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5575
5593
  puts '-[√] HTML 코드 5 code.......'.yellow
5594
+ sleep(1)
5595
+ @driver.find_element(:xpath, '//*[@id="chk_html"]').click
5576
5596
  rescue
5577
5597
  begin
5578
5598
 
5579
- @driver.find_element(:xpath, '//*[@id="kboard_content-html"]').click
5599
+ html_bb = @driver.find_element(:xpath, '//*[@id="kboard_content-html"]')
5600
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5580
5601
  puts '-[√] HTML 코드 6 code.......'.yellow
5602
+ sleep(1)
5603
+ @driver.find_element(:xpath, '//*[@id="kboard_content-html"]').click
5581
5604
  rescue
5582
5605
  begin
5583
5606
 
5584
- @driver.find_element(:xpath, '//*[@alt="코드"]').click
5607
+ html_bb = @driver.find_element(:xpath, '//*[@alt="코드"]')
5608
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5585
5609
  puts '-[√] HTML 코드 7 code.......'.yellow
5610
+ sleep(1)
5611
+ @driver.find_element(:xpath, '//*[@alt="코드"]').click
5586
5612
  rescue
5587
5613
  begin
5588
5614
 
5589
- @driver.find_element(:xpath, '//*[@title="HTML 편집기"]').click
5615
+ html_bb = @driver.find_element(:xpath, '//*[@title="HTML 편집기"]')
5616
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5590
5617
  puts '-[√] HTML 코드 8 code.......'.yellow
5618
+ sleep(1)
5619
+ @driver.find_element(:xpath, '//*[@title="HTML 편집기"]').click
5591
5620
  rescue
5592
5621
  begin
5593
5622
 
5594
- @driver.find_element(:xpath, '//*[@name="tag"]').click
5623
+ html_bb = @driver.find_element(:xpath, '//*[@name="tag"]')
5624
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5595
5625
  puts '-[√] HTML 코드 9 code.......'.yellow
5626
+ sleep(1)
5627
+ @driver.find_element(:xpath, '//*[@name="tag"]').click
5596
5628
  rescue
5597
5629
  begin
5598
- @driver.find_element(:xpath, '//*[@name="html"]').click
5630
+ html_bb = @driver.find_element(:xpath, '//*[@name="html"]')
5631
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5599
5632
  puts '-[√] HTML 코드 10 code.......'.yellow
5600
5633
  sleep(1.5)
5634
+ @driver.find_element(:xpath, '//*[@name="html"]').click
5601
5635
 
5602
5636
  rescue
5603
5637
  begin
5604
5638
 
5605
- @driver.find_element(:xpath, '//*[@id="html"]').click
5639
+ html_bb = @driver.find_element(:xpath, '//*[@id="html"]')
5640
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5606
5641
  puts '-[√] HTML 코드 12 code.......'.yellow
5607
5642
  sleep(1)
5643
+ @driver.find_element(:xpath, '//*[@id="html"]').click
5608
5644
  rescue
5609
5645
  begin
5610
5646
 
5611
- @driver.find_element(:xpath, '//*[@data-wp-editor-id="kboard_content"]').click
5647
+ html_bb = @driver.find_element(:xpath, '//*[@data-wp-editor-id="kboard_content"]')
5648
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5612
5649
  puts '-[√] HTML 코드 13 code.......'.yellow
5613
5650
  sleep(1)
5651
+ @driver.find_element(:xpath, '//*[@data-wp-editor-id="kboard_content"]').click
5614
5652
  rescue
5615
5653
  begin
5616
5654
 
5617
- @driver.find_element(:xpath, '//*[@title="소스"]').click
5655
+ html_bb = @driver.find_element(:xpath, '//*[@title="소스"]')
5656
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5618
5657
  puts '-[√] HTML 코드 14 code.......'.yellow
5619
5658
  sleep(1)
5659
+ @driver.find_element(:xpath, '//*[@title="소스"]').click
5620
5660
  rescue
5621
5661
  begin
5622
5662
 
5623
- @driver.find_element(:xpath, '//*[@class="note-btn btn-codeview note-codeview-keep active"]').click
5663
+ html_bb = @driver.find_element(:xpath, '//*[@class="note-btn btn-codeview note-codeview-keep active"]')
5664
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5624
5665
  puts '-[√] HTML 코드 15 code.......'.yellow
5625
5666
  sleep(1)
5667
+ @driver.find_element(:xpath, '//*[@class="note-btn btn-codeview note-codeview-keep active"]').click
5626
5668
  rescue
5627
5669
  begin
5628
5670
 
5629
- @driver.find_element(:xpath, '//*[@for="html"]').click
5671
+ html_bb = @driver.find_element(:xpath, '//*[@for="html"]')
5672
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5630
5673
  puts '-[√] HTML 코드 16 code.......'.yellow
5631
5674
  sleep(1)
5675
+ @driver.find_element(:xpath, '//*[@for="html"]').click
5632
5676
  rescue
5633
5677
  begin
5634
5678
 
5635
- @driver.find_element(:xpath, '//*[@onclick="html_auto_br(this);"]').click
5679
+ html_bb = @driver.find_element(:xpath, '//*[@onclick="html_auto_br(this);"]')
5680
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5636
5681
  puts '-[√] HTML 코드 17 code.......'.yellow
5637
5682
  sleep(1)
5683
+ @driver.find_element(:xpath, '//*[@onclick="html_auto_br(this);"]').click
5638
5684
  rescue
5639
5685
  begin
5640
5686
 
5641
- @driver.find_element(:xpath, '//*[@data-title="코드보기"]').click
5687
+ html_bb = @driver.find_element(:xpath, '//*[@data-title="코드보기"]')
5688
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5642
5689
  puts '-[√] HTML 코드 18 code.......'.yellow
5643
5690
  sleep(1)
5691
+ @driver.find_element(:xpath, '//*[@data-title="코드보기"]').click
5644
5692
  rescue
5645
5693
  begin
5646
5694
 
5647
- @driver.find_element(:xpath, '//*[@title="에디터 타입"]').click
5695
+ html_bb = @driver.find_element(:xpath, '//*[@title="에디터 타입"]')
5696
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5648
5697
  puts '-[√] HTML 코드 19 code.......'.yellow
5649
5698
  sleep(1)
5699
+ @driver.find_element(:xpath, '//*[@title="에디터 타입"]').click
5650
5700
  rescue
5651
5701
  begin
5652
5702
 
5653
- @driver.find_element(:xpath, '//*[@aria-label="코드 보기"]').click
5703
+ html_bb = @driver.find_element(:xpath, '//*[@aria-label="코드 보기"]')
5704
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5654
5705
  puts '-[√] HTML 코드 20 code.......'.yellow
5655
5706
  sleep(1)
5707
+ @driver.find_element(:xpath, '//*[@aria-label="코드 보기"]').click
5656
5708
  rescue
5657
5709
  begin
5658
5710
 
5659
- @driver.find_element(:xpath, '//*[@id="fwrite"]/ul/li[2]/div/div/div').click
5711
+ html_bb = @driver.find_element(:xpath, '//*[@id="fwrite"]/ul/li[2]/div/div/div').click
5712
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5660
5713
  puts '-[√] HTML 코드 21 code.......'.yellow
5661
5714
  sleep(1)
5715
+ @driver.find_element(:xpath, '//*[@id="fwrite"]/ul/li[2]/div/div/div')
5662
5716
  rescue
5663
5717
  begin
5664
5718
 
5665
- @driver.find_element(:xpath, '//*[@data-cke-tooltip-text="소스"]').click
5719
+ html_bb = @driver.find_element(:xpath, '//*[@data-cke-tooltip-text="소스"]')
5720
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5666
5721
  puts '-[√] HTML 코드 22 code.......'.yellow
5667
5722
  sleep(1)
5723
+ @driver.find_element(:xpath, '//*[@data-cke-tooltip-text="소스"]').click
5668
5724
  rescue
5669
5725
  begin
5726
+ html_bb = @driver.find_element(:xpath, '//*[@id="moreMisc-1"]')
5727
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5728
+ sleep(1)
5670
5729
  @driver.find_element(:xpath, '//*[@id="moreMisc-1"]').click
5671
5730
  sleep(1)
5672
5731
  @driver.find_element(:xpath, '//*[@id="html-1"]').click
@@ -5674,33 +5733,43 @@ begin
5674
5733
  rescue
5675
5734
  begin
5676
5735
 
5677
- @driver.find_element(:xpath, '//*[@id="html-1"]').click
5736
+ html_bb = @driver.find_element(:xpath, '//*[@id="html-1"]')
5737
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5678
5738
  puts '-[√] HTML 코드 24 code.......'.yellow
5679
5739
  sleep(1)
5740
+ @driver.find_element(:xpath, '//*[@id="html-1"]').click
5680
5741
  rescue
5681
5742
  begin
5682
5743
 
5683
- @driver.find_element(:xpath, '//*[@class="fas fa-code"]').click
5744
+ html_bb = @driver.find_element(:xpath, '//*[@class="fas fa-code"]')
5745
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5684
5746
  puts '-[√] HTML 코드 25 code.......'.yellow
5685
5747
  sleep(1)
5748
+ @driver.find_element(:xpath, '//*[@class="fas fa-code"]').click
5686
5749
  rescue
5687
5750
  begin
5688
5751
 
5689
- @driver.find_element(:xpath, '//*[@title="HTML모드"]').click
5752
+ html_bb = @driver.find_element(:xpath, '//*[@title="HTML모드"]')
5753
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5690
5754
  puts '-[√] HTML 코드 26 code.......'.yellow
5691
5755
  sleep(1)
5756
+ @driver.find_element(:xpath, '//*[@title="HTML모드"]').click
5692
5757
  rescue
5693
5758
  begin
5694
5759
 
5695
- @driver.find_element(:xpath, '//*[@id="wr_content-html"]').click
5760
+ html_bb = @driver.find_element(:xpath, '//*[@id="wr_content-html"]')
5761
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5696
5762
  puts '-[√] HTML 코드 27 code.......'.yellow
5697
5763
  sleep(1)
5764
+ @driver.find_element(:xpath, '//*[@id="wr_content-html"]').click
5698
5765
  rescue
5699
5766
  begin
5700
5767
 
5701
- @driver.find_element(:xpath, '//*[@id="fwrite"]/div[2]/ul/li/label').click
5768
+ html_bb = @driver.find_element(:xpath, '//*[@id="fwrite"]/div[2]/ul/li/label')
5769
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", html_bb)
5702
5770
  puts '-[√] HTML 코드 28 code.......'.yellow
5703
5771
  sleep(1)
5772
+ @driver.find_element(:xpath, '//*[@id="fwrite"]/div[2]/ul/li/label').click
5704
5773
  rescue
5705
5774
 
5706
5775
  end
@@ -8006,151 +8075,170 @@ sleep(1)
8006
8075
  puts '-[√] 내용 등록 버튼 탐색 시작.......'.yellow
8007
8076
  ########─────────────────────────────▼▼▼▼▼▼▼ 등록버튼 ▼▼▼▼▼▼▼──────────────────────────────#######
8008
8077
  begin
8009
- @driver.find_element(:xpath, '//*[@value="등록"]').send_keys()
8010
- sleep(2)
8078
+ ss_button = @driver.find_element(:xpath, '//*[@value="등록"]')
8079
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8080
+ sleep(1)
8011
8081
 
8012
8082
  @driver.find_element(:xpath, '//*[@value="등록"]').click
8013
8083
  puts '-[√] 등록을 1번 코드로 시도하였습니다.......'.magenta
8014
8084
  sleep(5)
8015
8085
  rescue
8016
8086
  begin
8017
- @driver.find_element(:xpath, '//*[@alt="등록"]').send_keys()
8018
- sleep(2)
8087
+ ss_button = @driver.find_element(:xpath, '//*[@alt="등록"]')
8088
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8089
+ sleep(1)
8019
8090
 
8020
8091
  @driver.find_element(:xpath, '//*[@alt="등록"]').click
8021
8092
  puts '-[√] 등록을 2번 코드로 시도하였습니다.......'.magenta
8022
8093
  sleep(5)
8023
8094
  rescue
8024
8095
  begin
8025
- @driver.find_element(:xpath, '//*[@value="작성완료"]').send_keys()
8026
- sleep(2)
8096
+ ss_button = @driver.find_element(:xpath, '//*[@value="작성완료"]')
8097
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8098
+ sleep(1)
8027
8099
 
8028
8100
  @driver.find_element(:xpath, '//*[@value="작성완료"]').click
8029
8101
  puts '-[√] 등록을 3번 코드로 시도하였습니다.......'.magenta
8030
8102
  sleep(5)
8031
8103
  rescue
8032
8104
  begin
8033
- @driver.find_element(:xpath, '//*[@id="btn_submit"]').send_keys()
8034
- sleep(2)
8105
+ ss_button = @driver.find_element(:xpath, '//*[@id="btn_submit"]')
8106
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8107
+ sleep(1)
8035
8108
  @driver.find_element(:xpath, '//*[@id="btn_submit"]').click
8036
8109
  puts '-[√] 등록을 4번 코드로 시도하였습니다.......'.magenta
8037
8110
  sleep(5)
8038
8111
  rescue
8039
8112
  begin
8040
- @driver.find_element(:xpath, '//*[@class="btn btn-success btn-sm"]').send_keys()
8041
- sleep(2)
8113
+ ss_button = @driver.find_element(:xpath, '//*[@class="btn btn-success btn-sm"]')
8114
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8115
+ sleep(1)
8042
8116
 
8043
8117
  @driver.find_element(:xpath, '//*[@class="btn btn-success btn-sm"]').click
8044
8118
  puts '-[√] 등록을 5번 코드로 시도하였습니다.......'.magenta
8045
8119
  sleep(5)
8046
8120
  rescue
8047
8121
  begin
8048
- @driver.find_element(:xpath, '//*[@class="btn btn-default btn-send-write"]').send_keys()
8049
- sleep(2)
8122
+ ss_button = @driver.find_element(:xpath, '//*[@class="btn btn-default btn-send-write"]')
8123
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8124
+ sleep(1)
8050
8125
 
8051
8126
  @driver.find_element(:xpath, '//*[@class="btn btn-default btn-send-write"]').click
8052
8127
  puts '-[√] 등록을 6번 코드로 시도하였습니다.......'.magenta
8053
8128
  sleep(5)
8054
8129
  rescue
8055
8130
  begin
8056
- @driver.find_element(:xpath, '//*[@title="확인"]').send_keys()
8057
- sleep(2)
8131
+ ss_button = @driver.find_element(:xpath, '//*[@title="확인"]')
8132
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8133
+ sleep(1)
8058
8134
 
8059
8135
  @driver.find_element(:xpath, '//*[@title="확인"]').click
8060
8136
  puts '-[√] 등록을 7번 코드로 시도하였습니다.......'.magenta
8061
8137
  sleep(5)
8062
8138
  rescue
8063
8139
  begin
8064
- @driver.find_element(:xpath, '//*[@id="btnSubmit"]').send_keys()
8065
- sleep(2)
8140
+ ss_button = @driver.find_element(:xpath, '//*[@id="btnSubmit"]')
8141
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8142
+ sleep(1)
8066
8143
 
8067
8144
  @driver.find_element(:xpath, '//*[@id="btnSubmit"]').click
8068
8145
  puts '-[√] 등록을 8번 코드로 시도하였습니다.......'.magenta
8069
8146
  sleep(5)
8070
8147
  rescue
8071
8148
  begin
8072
- @driver.find_element(:xpath, '//*[@src="images/board8_input.gif"]').send_keys()
8073
- sleep(2)
8149
+ ss_button = @driver.find_element(:xpath, '//*[@src="images/board8_input.gif"]')
8150
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8151
+ sleep(1)
8074
8152
 
8075
8153
  @driver.find_element(:xpath, '//*[@src="images/board8_input.gif"]').click
8076
8154
  puts '-[√] 등록을 9번 코드로 시도하였습니다.......'.magenta
8077
8155
  sleep(5)
8078
8156
  rescue
8079
8157
  begin
8080
- @driver.find_element(:xpath, '//*[@align="absmiddle"]').send_keys()
8081
- sleep(2)
8158
+ ss_button = @driver.find_element(:xpath, '//*[@align="absmiddle"]')
8159
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8160
+ sleep(1)
8082
8161
 
8083
8162
  @driver.find_element(:xpath, '//*[@align="absmiddle"]').click
8084
8163
  puts '-[√] 등록을 10번 코드로 시도하였습니다.......'.magenta
8085
8164
  sleep(5)
8086
8165
  rescue
8087
8166
  begin
8088
- @driver.find_element(:partial_link_text, '작성완료').send_keys()
8089
- sleep(2)
8167
+ ss_button = @driver.find_element(:partial_link_text, '작성완료')
8168
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8169
+ sleep(1)
8090
8170
 
8091
8171
  @driver.find_element(:partial_link_text, '작성완료').click#요소같고 텍스트가 다를때 텍스트로 타겟
8092
8172
  puts '-[√] 등록을 11번 코드로 시도하였습니다.......'.magenta
8093
8173
  sleep(5)
8094
8174
  rescue
8095
8175
  begin
8096
- @driver.find_element(:xpath, '//*[@class="_save_post save_post btn"]').send_keys()
8097
- sleep(2)
8176
+ ss_button = @driver.find_element(:xpath, '//*[@class="_save_post save_post btn"]')
8177
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8178
+ sleep(1)
8098
8179
 
8099
8180
  @driver.find_element(:xpath, '//*[@class="_save_post save_post btn"]').click
8100
8181
  puts '-[√] 등록을 12번 코드로 시도하였습니다.......'.magenta
8101
8182
  sleep(5)
8102
8183
  rescue
8103
8184
  begin
8104
- @driver.find_element(:xpath, '//*[@id="main_btn_box"]/button').send_keys()
8105
- sleep(2)
8185
+ ss_button = @driver.find_element(:xpath, '//*[@id="main_btn_box"]/button')
8186
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8187
+ sleep(1)
8106
8188
 
8107
8189
  @driver.find_element(:xpath, '//*[@id="main_btn_box"]/button').click
8108
8190
  puts '-[√] 등록을 13번 코드로 시도하였습니다.......'.magenta
8109
8191
  sleep(5)
8110
8192
  rescue
8111
8193
  begin
8112
- @driver.find_element(:xpath, '//*[@id="bttnComplete1"]').send_keys()
8113
- sleep(2)
8194
+ ss_button = @driver.find_element(:xpath, '//*[@id="bttnComplete1"]')
8195
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8196
+ sleep(1)
8114
8197
 
8115
8198
  @driver.find_element(:xpath, '//*[@id="bttnComplete1"]').click
8116
8199
  puts '-[√] 등록을 14번 코드로 시도하였습니다.......'.magenta
8117
8200
  sleep(5)
8118
8201
  rescue
8119
8202
  begin
8120
- @driver.find_element(:xpath, '//*[@id="bd-write-btns"]/button').send_keys()
8121
- sleep(2)
8203
+ ss_button = @driver.find_element(:xpath, '//*[@id="bd-write-btns"]/button')
8204
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8205
+ sleep(1)
8122
8206
 
8123
8207
  @driver.find_element(:xpath, '//*[@id="bd-write-btns"]/button').click
8124
8208
  puts '-[√] 등록을 15번 코드로 시도하였습니다.......'.magenta
8125
8209
  sleep(5)
8126
8210
  rescue
8127
8211
  begin
8128
- @driver.find_element(:xpath, '//*[@id="com_btn"]').send_keys()
8129
- sleep(2)
8212
+ ss_button = @driver.find_element(:xpath, '//*[@id="com_btn"]')
8213
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8214
+ sleep(1)
8130
8215
 
8131
8216
  @driver.find_element(:xpath, '//*[@id="com_btn"]').click
8132
8217
  puts '-[√] 등록을 16번 코드로 시도하였습니다.......'.magenta
8133
8218
  sleep(5)
8134
8219
  rescue
8135
8220
  begin
8136
- @driver.find_element(:xpath, '//*[@class="submit"]').send_keys()
8137
- sleep(2)
8221
+ ss_button = @driver.find_element(:xpath, '//*[@class="submit"]')
8222
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8223
+ sleep(1)
8138
8224
 
8139
8225
  @driver.find_element(:xpath, '//*[@class="submit"]').click
8140
8226
  puts '-[√] 등록을 17번 코드로 시도하였습니다.......'.magenta
8141
8227
  sleep(5)
8142
8228
  rescue
8143
8229
  begin
8144
- @driver.find_element(:xpath, '//*[@id="savePostInBoard"]').send_keys()
8145
- sleep(2)
8230
+ ss_button = @driver.find_element(:xpath, '//*[@id="savePostInBoard"]')
8231
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8232
+ sleep(1)
8146
8233
 
8147
8234
  @driver.find_element(:xpath, '//*[@id="savePostInBoard"]').click
8148
8235
  puts '-[√] 등록을 18번 코드로 시도하였습니다.......'.magenta
8149
8236
  sleep(5)
8150
8237
  rescue
8151
8238
  begin
8152
- @driver.find_element(:xpath, '//*[@form="write"]').send_keys()
8153
- sleep(2)
8239
+ ss_button = @driver.find_element(:xpath, '//*[@form="write"]')
8240
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8241
+ sleep(1)
8154
8242
 
8155
8243
  @driver.find_element(:xpath, '//*[@form="write"]').click
8156
8244
  puts '-[√] 등록을 19번 코드로 시도하였습니다.......'.magenta
@@ -8158,8 +8246,9 @@ rescue
8158
8246
 
8159
8247
  rescue
8160
8248
  begin
8161
- @driver.find_element(:partial_link_text, '저장하기').send_keys()
8162
- sleep(2)
8249
+ ss_button = @driver.find_element(:partial_link_text, '저장하기')
8250
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8251
+ sleep(1)
8163
8252
 
8164
8253
  @driver.find_element(:partial_link_text, '저장하기').click #요소같고 텍스트가 다를때 텍스트로 타겟
8165
8254
  puts '-[√] 등록을 20번 코드로 시도하였습니다.......'.magenta
@@ -8167,8 +8256,9 @@ rescue
8167
8256
 
8168
8257
  rescue
8169
8258
  begin
8170
- @driver.find_element(:xpath, '//*[@id="boardWriteForm"]/div/div[3]/a[2]').send_keys()
8171
- sleep(2)
8259
+ ss_button = @driver.find_element(:xpath, '//*[@id="boardWriteForm"]/div/div[3]/a[2]')
8260
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8261
+ sleep(1)
8172
8262
 
8173
8263
  @driver.find_element(:xpath, '//*[@id="boardWriteForm"]/div/div[3]/a[2]').click
8174
8264
  puts '-[√] 등록을 21시도하였습니다.......'.magenta
@@ -8176,9 +8266,9 @@ rescue
8176
8266
 
8177
8267
  rescue
8178
8268
  begin
8179
- el_btn = @driver.find_element(:xpath, '//*[@class="btnWrite"]')
8180
- @driver.action.move_to(el_btn).perform
8181
- sleep(2)
8269
+ ss_button = @driver.find_element(:xpath, '//*[@class="btnWrite"]')
8270
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8271
+ sleep(1)
8182
8272
 
8183
8273
  @driver.find_element(:xpath, '//*[@class="btnWrite"]').click
8184
8274
  puts '-[√] 등록을 22시도하였습니다.......'.magenta
@@ -8186,43 +8276,47 @@ rescue
8186
8276
 
8187
8277
  rescue
8188
8278
  begin
8189
- @driver.find_element(:xpath, '//*[@class="btn_blue btn_svc write"]').send_keys()
8190
- sleep(2)
8279
+ ss_button = @driver.find_element(:xpath, '//*[@class="btn_blue btn_svc write"]')
8280
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8281
+ sleep(1)
8191
8282
 
8192
8283
  @driver.find_element(:xpath, '//*[@class="btn_blue btn_svc write"]').click
8193
- puts '-[√] 등록을 24번 코드로 시도하였습니다.......'.magenta
8284
+ puts '-[√] 등록을 23번 코드로 시도하였습니다.......'.magenta
8194
8285
  sleep(5)
8195
8286
 
8196
8287
  rescue
8197
8288
  begin
8198
- @driver.find_element(:xpath, '//*[@type="submit"]').send_keys()
8199
- sleep(2)
8289
+ ss_button = @driver.find_element(:xpath, '//*[@type="submit"]')
8290
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8291
+ sleep(1)
8200
8292
 
8201
8293
  @driver.find_element(:xpath, '//*[@type="submit"]').click
8202
- puts '-[√] 등록을 23번 코드로 시도하였습니다.......'.magenta
8294
+ puts '-[√] 등록을 24번 코드로 시도하였습니다.......'.magenta
8203
8295
  sleep(5)
8204
8296
 
8205
8297
  rescue
8206
8298
  begin
8207
- @driver.find_element(:xpath, '//*[@class="button-agree"]').send_keys()
8208
- sleep(2)
8299
+ ss_button = @driver.find_element(:xpath, '//*[@class="button-agree"]')
8300
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8301
+ sleep(1)
8209
8302
 
8210
8303
  @driver.find_element(:xpath, '//*[@class="button-agree"]').click
8211
- puts '-[√] 등록을 23번 코드로 시도하였습니다.......'.magenta
8304
+ puts '-[√] 등록을 25번 코드로 시도하였습니다.......'.magenta
8212
8305
  sleep(5)
8213
8306
 
8214
8307
  rescue
8215
8308
  begin
8216
- @driver.find_element(:xpath, '//*[@class="btnSubmitFix sizeM"]').send_keys()
8217
- sleep(2)
8309
+ ss_button = @driver.find_element(:xpath, '//*[@class="btnSubmitFix sizeM"]')
8310
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", ss_button)
8311
+ sleep(1)
8218
8312
 
8219
8313
  @driver.find_element(:xpath, '//*[@class="btnSubmitFix sizeM"]').click
8220
- puts '-[√] 등록을 23번 코드로 시도하였습니다.......'.magenta
8314
+ puts '-[√] 등록을 26번 코드로 시도하였습니다.......'.magenta
8221
8315
  sleep(5)
8222
8316
 
8223
8317
  rescue
8224
-
8225
-
8318
+
8319
+
8226
8320
  ########─────────────────────────────▼▼▼▼▼▼▼ 등록버튼 2차 시도 ▼▼▼▼▼▼▼──────────────────────────────#######
8227
8321
  begin
8228
8322
  puts '-[√] 등록 버튼 코드 탐색에 실패하였습니다.......'.magenta
@@ -8380,13 +8474,22 @@ rescue
8380
8474
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
8381
8475
  puts '-[√] 등록을 시도하였습니다.......'.magenta
8382
8476
  sleep(5)
8383
- rescue
8477
+
8478
+ rescue => e
8384
8479
  puts '-[√] 등록 실패.......'.red
8385
8480
  puts '-[√] 로딩 및 코드인식 실패등 기타 이유로 다음 게시판 작업으로 이동합니다.......'.red
8386
8481
  puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
8387
- @driver.close
8388
-
8389
- end
8482
+ @driver.window_handles.each do |handle|
8483
+ @driver.switch_to.window(handle)
8484
+ begin
8485
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
8486
+ @driver.close
8487
+ rescue Selenium::WebDriver::Error::WebDriverError => e
8488
+ puts "Failed to close tab: #{e.message}"
8489
+ end
8490
+ end
8491
+ return 0
8492
+ end
8390
8493
 
8391
8494
  end
8392
8495
 
@@ -8491,22 +8594,38 @@ rescue
8491
8594
 
8492
8595
 
8493
8596
 
8494
- begin
8495
- @driver.close
8496
- rescue
8497
- end
8597
+
8598
+
8498
8599
 
8499
8600
  rescue => e
8500
8601
  puts '-[√] 글쓰기 페이지 접근 및 코드 탐색 ERROR 발생.......'.red
8501
- @driver.quit
8502
- end
8602
+ @driver.window_handles.each do |handle|
8603
+ @driver.switch_to.window(handle)
8604
+ begin
8605
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
8606
+ @driver.close
8607
+
8608
+ rescue Selenium::WebDriver::Error::WebDriverError => e
8609
+ puts "Failed to close tab: #{e.message}"
8610
+ end
8611
+ end
8612
+ return 0
8613
+ end
8503
8614
  sleep(1)
8504
8615
  ########크롬드라이버 전체 닫기##########
8505
8616
  begin
8506
- system("taskkill /f /im chromedriver.exe /t")
8507
- puts "크롬드라이버 강제 종료 성공"
8508
- rescue StandardError => e
8509
- @driver.close
8617
+ @driver.window_handles.each do |handle|
8618
+ @driver.switch_to.window(handle)
8619
+ begin
8620
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
8621
+ @driver.close
8622
+
8623
+ rescue Selenium::WebDriver::Error::WebDriverError => e
8624
+ puts "Failed to close tab: #{e.message}"
8625
+ end
8626
+ end
8627
+
8628
+ rescue
8510
8629
  end
8511
8630
  ########크롬드라이버 전체 닫기##########
8512
8631
 
@@ -8520,6 +8639,7 @@ end
8520
8639
  end
8521
8640
 
8522
8641
 
8642
+
8523
8643
  class Wordpress
8524
8644
  include Glimmer
8525
8645
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posting_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-21 00:00:00.000000000 Z
11
+ date: 2025-02-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com