posting_zon 0.0.67 → 0.0.72
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 +1401 -909
- metadata +1 -1
data/lib/posting_zon.rb
CHANGED
@@ -27,42 +27,72 @@ using Rainbow
|
|
27
27
|
|
28
28
|
|
29
29
|
class Naver
|
30
|
-
|
31
|
-
|
30
|
+
def initialize
|
31
|
+
=begin
|
32
|
+
begin
|
33
|
+
# webdrivers가 사용자의 Chrome 버전에 맞는 chromedriver 다운로드 시도
|
34
|
+
|
35
|
+
# Webdrivers가 드라이버를 다운로드할 경로를 설정
|
36
|
+
Webdrivers.cache_time = 86_400 # 하루로 설정 (기본값: 86_400초)
|
37
|
+
Webdrivers.install_dir = "./" # 크롬드라이버를 수동으로 설치할 경로를 설정
|
38
|
+
# 크롬드라이버 자동 업데이트 시도
|
39
|
+
Webdrivers::Chromedriver.update
|
40
|
+
puts "chromedriver 자동 다운로드 성공"
|
41
|
+
rescue => e
|
42
|
+
puts "chromedriver 자동 다운로드 실패: #{e.message}"
|
43
|
+
puts "폴더내 크롬드라이버를 사용합니다."
|
44
|
+
puts "크롬드라이버가 오래된 경우 오류 발생될 수 있으며, 만일 오류 발생시 아래 지침을 따라주세요."
|
45
|
+
puts "1.크롬 업데이트 2.프로그램 폴더 내부에 ★tip★-시작시-크롬창이....파일을 열어 드라이버를 교체하세요."
|
46
|
+
chromedriver_path = './chromedriver.exe' # 수동 경로를 인스턴스 변수로 설정
|
47
|
+
Selenium::WebDriver::Chrome::Service.driver_path = chromedriver_path
|
48
|
+
end
|
49
|
+
=end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def chrome_setup(proxy, board_cookie_dir = "C:/board_cookie")
|
54
|
+
board_cookie_dir = "C:/board_cookie"
|
55
|
+
FileUtils.mkdir_p(board_cookie_dir) unless File.exist?(board_cookie_dir)
|
56
|
+
|
57
|
+
if proxy == ''
|
58
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --window-position=0,0 --remote-debugging-port=9222 --user-data-dir=C:/board_cookie --no-first-run --no-default-browser-check --disable-sync https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko})
|
59
|
+
else
|
60
|
+
system(%{"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --window-position=0,0 --remote-debugging-port=9222 --user-data-dir=C:/board_cookie --proxy-server=#{proxy.to_s.force_encoding('utf-8').to_s} --no-first-run --no-default-browser-check --disable-sync https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
def chrome_start(proxy, board_cookie_dir = "C:/board_cookie")
|
67
|
+
board_cookie_dir = "C:/board_cookie"
|
68
|
+
FileUtils.mkdir_p(board_cookie_dir) unless File.exist?(board_cookie_dir)
|
32
69
|
if proxy == ''
|
33
70
|
begin
|
34
|
-
|
35
71
|
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
36
72
|
options = Selenium::WebDriver::Chrome::Options.new
|
37
|
-
options.
|
38
|
-
options.
|
73
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
74
|
+
#options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
75
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
76
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
77
|
+
options.add_argument('--no-default-browser-check')
|
39
78
|
options.page_load_strategy = :normal
|
40
|
-
options.timeouts = {
|
79
|
+
options.timeouts = {page_load: 30_000}
|
80
|
+
options.page_load_strategy = 'none'
|
81
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
41
82
|
options.add_argument('--disable-gpu')
|
42
|
-
options.add_argument('--
|
43
|
-
options.add_argument('user-
|
44
|
-
|
45
|
-
options.add_argument('--disable-
|
46
|
-
options.add_argument('--
|
47
|
-
|
48
|
-
|
49
|
-
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
50
|
-
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
51
|
-
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
52
|
-
options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
|
53
|
-
options.add_argument('--disable-software-rasterizer') # 소프트웨어 렌더링 비활성화
|
54
|
-
options.add_argument('--remote-debugging-port=9222') # 디버깅 포트 설정
|
55
|
-
options.add_argument("--disable-logging")
|
56
|
-
options.add_argument("--silent") # 로그를 최소화 (최소한의 경고만)
|
57
|
-
options.add_argument("--log-level=3") # LogLevel: 3 = ERROR
|
58
|
-
|
83
|
+
options.add_argument('--remote-debugging-port=9222')
|
84
|
+
options.add_argument('user-data-dir=C:/board_cookie')
|
85
|
+
|
86
|
+
options.add_argument('--disable-save-password-bubble') # 비밀번호 저장 팝업 비활성화
|
87
|
+
options.add_argument('--disable-password-manager') # 비밀번호 관리 비활성화
|
88
|
+
|
89
|
+
|
59
90
|
# 'capabilities'과 'options' 배열로 설정
|
60
91
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
61
92
|
capabilities["goog:chromeOptions"] = options.as_json
|
62
93
|
|
63
94
|
# Selenium 4에서는 'capabilities'만 사용하는 방식
|
64
95
|
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
65
|
-
|
66
96
|
|
67
97
|
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
68
98
|
|
@@ -71,35 +101,24 @@ class Naver
|
|
71
101
|
end
|
72
102
|
else
|
73
103
|
begin
|
74
|
-
|
75
|
-
puts '프록시 연결시 프록시 서버에 의해 인터넷속도가 낮아질수있어.......'.magenta
|
76
|
-
puts '원활한 작업이 되지않을수있습니다.......'.magenta
|
104
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
77
105
|
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
78
106
|
options = Selenium::WebDriver::Chrome::Options.new
|
107
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
108
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
109
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
110
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
111
|
+
options.add_argument('--no-default-browser-check')
|
79
112
|
options.add_argument '--proxy-server='+proxy.to_s.force_encoding('utf-8').to_s
|
80
|
-
options.add_extension('./crx/free.crx')
|
81
|
-
options.add_extension('./crx/app.crx')
|
82
113
|
options.page_load_strategy = :normal
|
83
|
-
options.timeouts = {
|
114
|
+
options.timeouts = {page_load: 30_000}
|
115
|
+
options.page_load_strategy = 'none'
|
116
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
84
117
|
options.add_argument('--disable-gpu')
|
85
|
-
options.add_argument('--
|
86
|
-
options.add_argument('user-
|
87
|
-
|
88
|
-
|
89
|
-
options.add_argument('--allow-running-insecure-content') # HTTPS 사이트에서 HTTP 컨텐츠 실행 허용
|
90
|
-
options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
|
91
|
-
options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
|
92
|
-
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
93
|
-
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
94
|
-
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
95
|
-
options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
|
96
|
-
options.add_argument('--disable-software-rasterizer') # 소프트웨어 렌더링 비활성화
|
97
|
-
options.add_argument('--remote-debugging-port=9222') # 디버깅 포트 설정
|
98
|
-
options.add_argument("--disable-logging")
|
99
|
-
options.add_argument("--silent") # 로그를 최소화 (최소한의 경고만)
|
100
|
-
options.add_argument("--log-level=3") # LogLevel: 3 = ERROR
|
101
|
-
|
102
|
-
|
118
|
+
options.add_argument('--remote-debugging-port=9222')
|
119
|
+
options.add_argument('user-data-dir=C:/board_cookie')
|
120
|
+
|
121
|
+
|
103
122
|
# 'capabilities'과 'options' 배열로 설정
|
104
123
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
105
124
|
capabilities["goog:chromeOptions"] = options.as_json
|
@@ -108,35 +127,28 @@ class Naver
|
|
108
127
|
@driver = Selenium::WebDriver.for(:chrome, capabilities: [capabilities, options])
|
109
128
|
|
110
129
|
@driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: function(){ return false; }});") # 셀레니움 감지 방지
|
111
|
-
|
112
130
|
rescue => e
|
113
131
|
puts e
|
114
132
|
puts 'proxy error...'
|
115
133
|
begin
|
134
|
+
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
116
135
|
Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
117
136
|
options = Selenium::WebDriver::Chrome::Options.new
|
118
|
-
options.
|
119
|
-
options.
|
137
|
+
options.add_argument('--no-first-run') # 자동 실행 시 나타나는 "첫 실행" 화면 방지
|
138
|
+
options.add_argument('--disable-extensions') # 확장 프로그램 초기화 화면 방지
|
139
|
+
options.add_argument('--disable-sync') # Chrome 동기화 비활성화
|
140
|
+
options.add_argument('--disable-popup-blocking') # 팝업 방지 (로그인 창이 뜨는 경우 대비)
|
141
|
+
options.add_argument('--no-default-browser-check')
|
120
142
|
options.page_load_strategy = :normal
|
121
|
-
options.timeouts = {
|
143
|
+
options.timeouts = {page_load: 30_000}
|
144
|
+
options.page_load_strategy = 'none'
|
145
|
+
options.add_argument('--disable-blink-features=AutomationControlled') #자동화된 환경에서 실행되는 것을 감지하는 기능을 비활성화합니다.
|
122
146
|
options.add_argument('--disable-gpu')
|
123
|
-
options.add_argument('--
|
124
|
-
options.add_argument('user-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
options.add_argument('--no-sandbox') # 샌드박스 모드 비활성화
|
129
|
-
options.exclude_switches = ['enable-automation'] # 자동화 테스트 제거
|
130
|
-
options.add_preference("profile.password_manager_enabled", false) # 비밀번호 관리자 비활성화
|
131
|
-
options.add_preference("credentials_enable_service", false) # 비밀번호 저장 기능 비활성화
|
132
|
-
options.add_preference("profile.default_content_setting_values.notifications", 2) # 알림 차단
|
133
|
-
options.add_argument("--disable-save-password-bubble") # 비밀번호 저장 팝업 차단
|
134
|
-
options.add_argument('--disable-software-rasterizer') # 소프트웨어 렌더링 비활성화
|
135
|
-
options.add_argument('--remote-debugging-port=9222') # 디버깅 포트 설정
|
136
|
-
options.add_argument("--disable-logging")
|
137
|
-
options.add_argument("--silent") # 로그를 최소화 (최소한의 경고만)
|
138
|
-
options.add_argument("--log-level=3") # LogLevel: 3 = ERROR
|
139
|
-
|
147
|
+
options.add_argument('--remote-debugging-port=9222')
|
148
|
+
options.add_argument('user-data-dir=C:/board_cookie')
|
149
|
+
|
150
|
+
|
151
|
+
|
140
152
|
# 'capabilities'과 'options' 배열로 설정
|
141
153
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
|
142
154
|
capabilities["goog:chromeOptions"] = options.as_json
|
@@ -151,51 +163,394 @@ class Naver
|
|
151
163
|
end
|
152
164
|
end
|
153
165
|
end
|
154
|
-
|
155
|
-
|
156
|
-
def login(proxy)
|
157
|
-
chrome_start(proxy)
|
158
166
|
|
159
|
-
|
160
|
-
|
167
|
+
def login(proxy, captcha_key, board_cookie_dir = "C:/board_cookie")
|
168
|
+
@captcha_key = captcha_key
|
169
|
+
@board_cookie_dir = "C:/board_cookie"
|
170
|
+
current_dir = File.dirname(__FILE__)
|
171
|
+
board_cookie_dir = "C:/board_cookie"
|
172
|
+
FileUtils.mkdir_p(board_cookie_dir) unless File.exist?(board_cookie_dir)
|
173
|
+
|
174
|
+
unless File.exist?(board_cookie_dir)
|
175
|
+
driverfile_src = File.join(current_dir, 'driverfile')
|
176
|
+
if Dir.exist?(driverfile_src)
|
177
|
+
FileUtils.cp_r(driverfile_src, board_cookie_dir)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# 새로운 스레드 생성 및 실행
|
182
|
+
Thread.new { chrome_setup(proxy, board_cookie_dir) }
|
161
183
|
|
184
|
+
# 충분한 대기 시간을 두고 실행
|
185
|
+
sleep(1)
|
186
|
+
|
187
|
+
chrome_start(proxy, board_cookie_dir)
|
188
|
+
|
162
189
|
# 열린 모든 탭 핸들 확인
|
163
190
|
all_windows = @driver.window_handles
|
164
|
-
puts "현재 열려 있는 탭 수: #{all_windows.size}" # 열린 탭 수 출력
|
165
|
-
|
166
|
-
#
|
191
|
+
#puts "현재 열려 있는 탭 수: #{all_windows.size}" # 열린 탭 수 출력
|
192
|
+
|
193
|
+
# 원하는 URL
|
194
|
+
target_url = "https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko"
|
195
|
+
|
196
|
+
# 각 탭을 순회하면서
|
167
197
|
all_windows.each do |window|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
puts "
|
178
|
-
|
198
|
+
@driver.switch_to.window(window)
|
199
|
+
current_url = @driver.current_url
|
200
|
+
#puts "탭 URL: #{current_url}" # 각 탭 URL 출력
|
201
|
+
|
202
|
+
# 원하는 URL이 아니면 탭을 닫기
|
203
|
+
if current_url != target_url
|
204
|
+
begin
|
205
|
+
@driver.close # 다른 탭을 닫기
|
206
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
207
|
+
#puts "탭을 닫는 데 오류 발생: #{e.message}"
|
208
|
+
end
|
179
209
|
end
|
180
|
-
|
181
|
-
|
210
|
+
end
|
211
|
+
|
212
|
+
# 남아 있는 탭으로 전환
|
182
213
|
all_windows = @driver.window_handles # 남은 탭 리스트 갱신
|
183
|
-
if all_windows.size
|
184
|
-
|
185
|
-
puts "빈 탭으로 전환됨."
|
214
|
+
if all_windows.size > 0
|
215
|
+
@driver.switch_to.window(all_windows.first) # 남아 있는 첫 번째 탭으로 전환
|
186
216
|
else
|
187
|
-
|
217
|
+
#puts "남은 탭이 없습니다."
|
188
218
|
end
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
@driver.get('chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html')
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
@driver.manage.window.maximize
|
194
223
|
sleep(1)
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
224
|
+
begin
|
225
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
226
|
+
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
|
227
|
+
check_cookie_login = 1
|
228
|
+
puts'[Step.01] CAPTCHA 세션 및 브라우저 설정 완료 상태 확인!!.......'.yellow
|
229
|
+
rescue
|
230
|
+
begin
|
231
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
232
|
+
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="wQO0od"]') } #추가 안되어 있음
|
233
|
+
sleep(1.5)
|
234
|
+
@driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="wQO0od"]').click
|
235
|
+
puts'[Step.01] CAPTCHA 세션 연결 없음!! 브라우저 필요 설정 미 완료 상태!!.......'.yellow
|
236
|
+
puts'[Step.02] CAPTCHA 세션 연결 및 브라우저 필요 설정 진행 시작!!.......'.yellow
|
237
|
+
sleep(1.5)
|
238
|
+
mouse_move_percentage(0.3,0.02)
|
239
|
+
sleep(0.5)
|
240
|
+
left_click
|
241
|
+
sleep(1)
|
242
|
+
key_stroke('tab')
|
243
|
+
sleep(0.5)
|
244
|
+
key_stroke('enter')
|
245
|
+
check_cookie_login = 0
|
246
|
+
sleep(1)
|
247
|
+
rescue
|
248
|
+
@driver.quit
|
249
|
+
return 0
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
if check_cookie_login == 0
|
254
|
+
sleep(10)
|
255
|
+
begin
|
256
|
+
|
257
|
+
begin
|
258
|
+
# 열린 모든 탭 핸들 확인
|
259
|
+
all_windows = @driver.window_handles
|
260
|
+
puts "현재 열려 있는 탭 수: #{all_windows.size}" # 열린 탭 수 출력
|
261
|
+
|
262
|
+
# 각 탭을 순회하면서
|
263
|
+
all_windows.each do |window|
|
264
|
+
@driver.switch_to.window(window)
|
265
|
+
current_url = @driver.current_url
|
266
|
+
puts "탭 URL: #{current_url}" # 각 탭 URL 출력
|
267
|
+
|
268
|
+
# 확장 프로그램 탭인지 확인
|
269
|
+
if current_url.include?('chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html')
|
270
|
+
begin
|
271
|
+
@driver.close # 확장 프로그램 탭을 닫기
|
272
|
+
|
273
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
274
|
+
end
|
275
|
+
else
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
# 남아 있는 탭으로 전환
|
280
|
+
all_windows = @driver.window_handles # 남은 탭 리스트 갱신
|
281
|
+
if all_windows.size > 0
|
282
|
+
@driver.switch_to.window(all_windows.first) # 남아 있는 첫 번째 탭으로 전환
|
283
|
+
else
|
284
|
+
end
|
285
|
+
|
286
|
+
sleep(1)
|
287
|
+
|
288
|
+
rescue => e
|
289
|
+
@driver.quit if @driver
|
290
|
+
end
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
# 빈 탭에서 원하는 작업을 진행하거나, 옵션 페이지로 이동
|
297
|
+
@driver.get('chrome-extension://ifibfemgeogfhoebkmokieepdoobkbpo/options/options.html')
|
298
|
+
sleep(1)
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
begin
|
305
|
+
puts '-[√] 캡챠 연결 설정 1차 시도.......'.green
|
306
|
+
# 요소 찾기 타임아웃을 10초로 설정
|
307
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
308
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
309
|
+
wait.until { @driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[2]/input') }
|
310
|
+
@driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[2]/input').click
|
311
|
+
sleep(1)
|
312
|
+
Clipboard.copy(captcha_key)
|
313
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
314
|
+
sleep(1)
|
315
|
+
@driver.find_element(:xpath, '//*[@id="connect"]').click
|
316
|
+
sleep(1)
|
317
|
+
|
318
|
+
begin
|
319
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
320
|
+
wait.until do
|
321
|
+
begin
|
322
|
+
alert = @driver.switch_to.alert
|
323
|
+
alert.accept
|
324
|
+
sleep(1)
|
325
|
+
true
|
326
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
327
|
+
false
|
328
|
+
end
|
329
|
+
end
|
330
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
331
|
+
puts "alert이 없으므로 버튼 클릭"
|
332
|
+
@driver.find_element(:xpath, '//*[@id="connect"]').click
|
333
|
+
begin
|
334
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
335
|
+
wait.until do
|
336
|
+
begin
|
337
|
+
alert = @driver.switch_to.alert
|
338
|
+
alert.accept
|
339
|
+
sleep(1)
|
340
|
+
true
|
341
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
342
|
+
false
|
343
|
+
end
|
344
|
+
end
|
345
|
+
puts "두 번째 alert 처리 완료"
|
346
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
347
|
+
puts "두 번째 alert이 10초 내에 나타나지 않음. Chrome 종료."
|
348
|
+
system('taskkill /F /IM chrome.exe')
|
349
|
+
@driver.quit if @driver
|
350
|
+
end
|
351
|
+
end
|
352
|
+
puts '-[√] 브라우저 필요 설정 1차 시도.......'.green
|
353
|
+
@driver.get('chrome://settings/security')
|
354
|
+
sleep(2)
|
355
|
+
mouse_move_percentage(0.3,0.02)
|
356
|
+
sleep(0.5)
|
357
|
+
left_click
|
358
|
+
sleep(1)
|
359
|
+
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
360
|
+
6.times do
|
361
|
+
key_stroke('tab') # 'tab' 키를 입력
|
362
|
+
sleep(0.5) # 0.5초 대기
|
363
|
+
end
|
364
|
+
key_stroke('enter')
|
365
|
+
sleep(1)
|
366
|
+
|
367
|
+
@driver.get('chrome://password-manager/settings')
|
368
|
+
sleep(2)
|
369
|
+
mouse_move_percentage(0.3,0.02)
|
370
|
+
sleep(0.5)
|
371
|
+
left_click
|
372
|
+
sleep(1)
|
373
|
+
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
374
|
+
3.times do
|
375
|
+
key_stroke('tab') # 'tab' 키를 입력
|
376
|
+
sleep(0.5) # 0.5초 대기
|
377
|
+
end
|
378
|
+
key_stroke('enter')
|
379
|
+
sleep(1)
|
380
|
+
|
381
|
+
rescue
|
382
|
+
begin
|
383
|
+
puts '-[√] 캡챠 연결 설정 2차 시도.......'.green
|
384
|
+
sleep(1)
|
385
|
+
#@driver.switch_to.window(@driver.window_handles[0])
|
386
|
+
|
387
|
+
|
388
|
+
# 요소 찾기 타임아웃을 10초로 설정
|
389
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
390
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
391
|
+
wait.until { @driver.find_element(:xpath, '//*[@name="apiKey"]') }
|
392
|
+
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
393
|
+
sleep(1)
|
394
|
+
begin
|
395
|
+
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
396
|
+
rescue
|
397
|
+
|
398
|
+
puts '-[√] 로딩 및 코드인식 실패등 기타 이유로 다음 게시판 작업으로 이동합니다.......'.red
|
399
|
+
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
400
|
+
|
401
|
+
end
|
402
|
+
|
403
|
+
Clipboard.copy(captcha_key)
|
404
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
405
|
+
sleep(1)
|
406
|
+
begin
|
407
|
+
@driver.find_element(:xpath, '//*[@class="default-btn"]').click
|
408
|
+
sleep(1)
|
409
|
+
|
410
|
+
begin
|
411
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
412
|
+
wait.until do
|
413
|
+
begin
|
414
|
+
alert = @driver.switch_to.alert
|
415
|
+
alert.accept
|
416
|
+
sleep(1)
|
417
|
+
true
|
418
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
419
|
+
false
|
420
|
+
end
|
421
|
+
end
|
422
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
423
|
+
puts "alert이 없으므로 버튼 클릭"
|
424
|
+
@driver.find_element(:xpath, '//*[@class="default-btn"]').click
|
425
|
+
begin
|
426
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
427
|
+
wait.until do
|
428
|
+
begin
|
429
|
+
alert = @driver.switch_to.alert
|
430
|
+
alert.accept
|
431
|
+
sleep(1)
|
432
|
+
true
|
433
|
+
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
434
|
+
false
|
435
|
+
end
|
436
|
+
end
|
437
|
+
puts "두 번째 alert 처리 완료"
|
438
|
+
rescue Selenium::WebDriver::Error::TimeoutError
|
439
|
+
puts "두 번째 alert이 10초 내에 나타나지 않음. Chrome 종료."
|
440
|
+
system('taskkill /F /IM chrome.exe')
|
441
|
+
@driver.quit if @driver
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
rescue => e
|
446
|
+
@driver.window_handles.each do |handle|
|
447
|
+
@driver.switch_to.window(handle)
|
448
|
+
begin
|
449
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
450
|
+
@driver.close
|
451
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
452
|
+
puts "크롬 브라우저 종료: #{e.message}"
|
453
|
+
end
|
454
|
+
end
|
455
|
+
return 0
|
456
|
+
@driver.quit
|
457
|
+
end
|
458
|
+
puts '-[√] 브라우저 필요 설정 2차 시도.......'.green
|
459
|
+
@driver.get('chrome://settings/security')
|
460
|
+
sleep(2)
|
461
|
+
mouse_move_percentage(0.3,0.02)
|
462
|
+
sleep(0.5)
|
463
|
+
left_click
|
464
|
+
sleep(1)
|
465
|
+
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
466
|
+
6.times do
|
467
|
+
key_stroke('tab') # 'tab' 키를 입력
|
468
|
+
sleep(0.5) # 0.5초 대기
|
469
|
+
end
|
470
|
+
key_stroke('enter')
|
471
|
+
sleep(1)
|
472
|
+
|
473
|
+
@driver.get('chrome://password-manager/settings')
|
474
|
+
sleep(2)
|
475
|
+
mouse_move_percentage(0.3,0.02)
|
476
|
+
sleep(0.5)
|
477
|
+
left_click
|
478
|
+
sleep(1)
|
479
|
+
# 루비에서 'tab' 키를 0.5초마다 7번 누르기
|
480
|
+
3.times do
|
481
|
+
key_stroke('tab') # 'tab' 키를 입력
|
482
|
+
sleep(0.5) # 0.5초 대기
|
483
|
+
end
|
484
|
+
key_stroke('enter')
|
485
|
+
sleep(1)
|
486
|
+
|
487
|
+
rescue => e
|
488
|
+
puts '-[√] 로딩 및 코드인식 실패등 기타 이유로 다음 게시판 작업으로 이동합니다.......'.red
|
489
|
+
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
490
|
+
@driver.window_handles.each do |handle|
|
491
|
+
@driver.switch_to.window(handle)
|
492
|
+
begin
|
493
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
494
|
+
@driver.close
|
495
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
496
|
+
puts "크롬 브라우저 종료: #{e.message}"
|
497
|
+
end
|
498
|
+
end
|
499
|
+
return 0
|
500
|
+
@driver.quit
|
501
|
+
end
|
502
|
+
|
503
|
+
end
|
504
|
+
|
505
|
+
rescue => e
|
506
|
+
puts '-[√] 로딩 지연 접속 실패.......'.red
|
507
|
+
@driver.window_handles.each do |handle|
|
508
|
+
@driver.switch_to.window(handle)
|
509
|
+
begin
|
510
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
511
|
+
@driver.close
|
512
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
513
|
+
puts "Failed to close tab: #{e.message}"
|
514
|
+
end
|
515
|
+
end
|
516
|
+
@driver.quit
|
517
|
+
return 0
|
518
|
+
end
|
519
|
+
|
520
|
+
else
|
521
|
+
# @driver.switch_to.default_content
|
522
|
+
end
|
523
|
+
|
524
|
+
begin
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
@driver.get('https://chromewebstore.google.com/detail/captcha-solver-auto-recog/ifibfemgeogfhoebkmokieepdoobkbpo?hl=ko')
|
529
|
+
|
530
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
531
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
532
|
+
wait.until { @driver.find_element(xpath: '//section[@class="lwrbTd"]//button[@jsname="ajZLRd"]') } #추가 되어 있음
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
rescue => e
|
537
|
+
puts '-[√] 로그인 실패.......'.red
|
538
|
+
@driver.window_handles.each do |handle|
|
539
|
+
@driver.switch_to.window(handle)
|
540
|
+
begin
|
541
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
542
|
+
@driver.close
|
543
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
544
|
+
puts "Failed to close tab: #{e.message}"
|
545
|
+
end
|
546
|
+
end
|
547
|
+
@driver.quit
|
548
|
+
return 0
|
549
|
+
end
|
550
|
+
end
|
551
|
+
|
552
|
+
|
553
|
+
|
199
554
|
|
200
555
|
|
201
556
|
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)
|
@@ -218,210 +573,81 @@ def update(user_id, user_pw, title, content, option, post_url, signup_url, login
|
|
218
573
|
|
219
574
|
|
220
575
|
####################탭나누기 수정중######################################
|
221
|
-
begin
|
222
|
-
puts '-[√] 투 캡챠 api 입력 시도 1.......'.green
|
223
|
-
|
224
|
-
#@driver.switch_to.window(@driver.window_handles[0])
|
225
|
-
|
226
576
|
|
227
|
-
# 요소 찾기 타임아웃을 10초로 설정
|
228
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
229
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
230
|
-
wait.until { @driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[2]/input') }
|
231
|
-
@driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[2]/input').click
|
232
|
-
sleep(1)
|
233
|
-
Clipboard.copy(captcha_key)
|
234
|
-
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
235
|
-
sleep(1)
|
236
|
-
@driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[3]/button').click
|
237
|
-
sleep(1)
|
238
|
-
|
239
|
-
begin
|
240
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
241
|
-
wait.until do
|
242
|
-
begin
|
243
|
-
alert = @driver.switch_to.alert
|
244
|
-
alert.accept
|
245
|
-
true
|
246
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
247
|
-
false
|
248
|
-
end
|
249
|
-
end
|
250
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
251
|
-
puts "alert이 없으므로 버튼 클릭"
|
252
|
-
@driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[3]/button').click
|
253
|
-
begin
|
254
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
255
|
-
wait.until do
|
256
|
-
begin
|
257
|
-
alert = @driver.switch_to.alert
|
258
|
-
alert.accept
|
259
|
-
true
|
260
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
261
|
-
false
|
262
|
-
end
|
263
|
-
end
|
264
|
-
puts "두 번째 alert 처리 완료"
|
265
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
266
|
-
puts "두 번째 alert이 10초 내에 나타나지 않음. Chrome 종료."
|
267
|
-
system('taskkill /F /IM chrome.exe')
|
268
|
-
@driver.quit if @driver
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
577
|
|
273
|
-
|
274
|
-
|
275
|
-
puts '-[√] 투 캡챠 api 입력 시도 2.......'.green
|
276
|
-
sleep(1)
|
277
|
-
#@driver.switch_to.window(@driver.window_handles[0])
|
578
|
+
|
579
|
+
signup_url = option['signup_url'].to_s
|
278
580
|
|
279
581
|
|
280
|
-
# 요소 찾기 타임아웃을 10초로 설정
|
281
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 5)
|
282
|
-
#요소가 나타날 때까지 60초 동안 기다립니다.
|
283
|
-
wait.until { @driver.find_element(:xpath, '//*[@name="apiKey"]') }
|
284
|
-
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
285
|
-
sleep(1)
|
286
|
-
begin
|
287
|
-
@driver.find_element(:xpath, '//*[@name="apiKey"]').click
|
288
|
-
rescue
|
289
|
-
|
290
|
-
puts '-[√] 로딩 및 코드인식 실패등 기타 이유로 다음 게시판 작업으로 이동합니다.......'.red
|
291
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
292
|
-
|
293
|
-
end
|
294
582
|
|
295
|
-
Clipboard.copy(captcha_key)
|
296
|
-
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
297
|
-
sleep(1)
|
298
|
-
begin
|
299
|
-
@driver.find_element(:class_name, 'default-btn').click
|
300
|
-
sleep(1)
|
301
583
|
|
584
|
+
begin
|
585
|
+
if signup_url == '' or signup_url == '회원가입 페이지 url'
|
586
|
+
|
587
|
+
else
|
588
|
+
@driver.get(signup_url)
|
589
|
+
puts '-[√] 회원가입 페이지 URL 이동.......'.magenta
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
|
302
595
|
begin
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
310
|
-
false
|
311
|
-
end
|
596
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
597
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
598
|
+
if error_text
|
599
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
600
|
+
@driver.quit if @driver
|
601
|
+
return 0
|
312
602
|
end
|
313
|
-
rescue
|
314
|
-
puts "alert이 없으므로 버튼 클릭"
|
315
|
-
@driver.find_element(:xpath, '/html/body/div/div[1]/table/tbody/tr[1]/td[3]/button').click
|
316
|
-
begin
|
317
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
318
|
-
wait.until do
|
319
|
-
begin
|
320
|
-
alert = @driver.switch_to.alert
|
321
|
-
alert.accept
|
322
|
-
true
|
323
|
-
rescue Selenium::WebDriver::Error::NoSuchAlertError
|
324
|
-
false
|
325
|
-
end
|
326
|
-
end
|
327
|
-
puts "두 번째 alert 처리 완료"
|
328
|
-
rescue Selenium::WebDriver::Error::TimeoutError
|
329
|
-
puts "두 번째 alert이 10초 내에 나타나지 않음. Chrome 종료."
|
330
|
-
system('taskkill /F /IM chrome.exe')
|
331
|
-
@driver.quit if @driver
|
332
|
-
end
|
603
|
+
rescue
|
333
604
|
end
|
334
|
-
|
335
|
-
rescue => e
|
336
|
-
@driver.window_handles.each do |handle|
|
337
|
-
@driver.switch_to.window(handle)
|
338
|
-
begin
|
339
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
340
|
-
@driver.close
|
341
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
342
|
-
puts "크롬 브라우저 종료: #{e.message}"
|
343
|
-
end
|
344
|
-
end
|
345
|
-
return 0
|
346
|
-
@driver.quit
|
347
|
-
end
|
348
605
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
@driver.close
|
357
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
358
|
-
puts "크롬 브라우저 종료: #{e.message}"
|
606
|
+
begin
|
607
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
608
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"Connection timed out")]')
|
609
|
+
if error_text
|
610
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
611
|
+
@driver.quit if @driver
|
612
|
+
return 0
|
359
613
|
end
|
614
|
+
rescue
|
360
615
|
end
|
361
|
-
return 0
|
362
|
-
@driver.quit
|
363
|
-
end
|
364
|
-
|
365
|
-
end
|
366
|
-
#@driver.switch_to.window(@driver.window_handles[0])
|
367
|
-
####################탭나누기 수정중######################################
|
368
|
-
sleep(2)
|
369
|
-
|
370
616
|
|
617
|
+
begin
|
618
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 2) # 3초 대기
|
619
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
620
|
+
alert.accept # 알림을 확인
|
621
|
+
rescue
|
622
|
+
end
|
371
623
|
|
372
|
-
|
373
|
-
|
374
|
-
|
624
|
+
|
625
|
+
sleep(1)
|
626
|
+
|
627
|
+
|
628
|
+
|
375
629
|
|
376
630
|
|
377
631
|
|
378
|
-
begin
|
379
|
-
if signup_url == '' or signup_url == '회원가입 페이지 url'
|
380
632
|
|
381
|
-
|
382
|
-
|
633
|
+
#오른쪽 마우스 해제 코드
|
383
634
|
begin
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
rescue Selenium::WebDriver::Error::UnknownError => e
|
401
|
-
puts "#{signup_url} 해당 사이트의 문제로 접속이 불가능합니다." # 오류 메시지 출력
|
402
|
-
# 열린 모든 창을 닫음
|
403
|
-
@driver.window_handles.each do |handle|
|
404
|
-
@driver.switch_to.window(handle)
|
405
|
-
begin
|
406
|
-
@driver.close
|
407
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
408
|
-
puts "사이트 내부에 예외 발생: #{e.message}"
|
409
|
-
end
|
410
|
-
end
|
411
|
-
|
412
|
-
# 드라이버 종료
|
413
|
-
@driver.quit if @driver
|
414
|
-
return 0
|
415
|
-
|
416
|
-
rescue Selenium::WebDriver::Error::TimeoutError => e
|
417
|
-
puts "웹 페이지 로드가 시간 초과되었습니다: #{e.message}"
|
418
|
-
@driver.quit if @driver
|
419
|
-
return 0
|
420
|
-
|
421
|
-
rescue
|
422
|
-
end
|
423
|
-
|
424
|
-
|
635
|
+
@driver.execute_script <<-JS
|
636
|
+
document.querySelectorAll('body').forEach(function(element) {
|
637
|
+
element.oncontextmenu = null;
|
638
|
+
});
|
639
|
+
document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
|
640
|
+
JS
|
641
|
+
|
642
|
+
@driver.execute_script <<-JS
|
643
|
+
document.addEventListener('contextmenu', function(e) {
|
644
|
+
e.stopImmediatePropagation();
|
645
|
+
}, true);
|
646
|
+
JS
|
647
|
+
|
648
|
+
@driver.execute_script("window.oncontextmenu = null;")
|
649
|
+
rescue
|
650
|
+
end
|
425
651
|
|
426
652
|
|
427
653
|
|
@@ -435,6 +661,8 @@ sleep(2)
|
|
435
661
|
puts '-[√] 3 캡챠 발생 유무 확인.......'.green
|
436
662
|
sleep(2)
|
437
663
|
|
664
|
+
|
665
|
+
|
438
666
|
begin
|
439
667
|
@driver.find_element(:xpath, '//*[@class="amzn-captcha-state-container"]')
|
440
668
|
puts '-[√] 아임웹 캡챠 확인!! 해제 실행.......'.green
|
@@ -610,9 +838,22 @@ sleep(2)
|
|
610
838
|
begin
|
611
839
|
sleep(1)
|
612
840
|
@driver.switch_to.alert.accept
|
841
|
+
sleep(1)
|
613
842
|
rescue
|
614
843
|
end
|
615
844
|
|
845
|
+
begin
|
846
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
847
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
848
|
+
if error_text
|
849
|
+
puts '사이트에 연결할 수 없음 텍스트가 발견되었습니다. 창을 닫습니다.'
|
850
|
+
@driver.quit if @driver
|
851
|
+
return 0
|
852
|
+
end
|
853
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
854
|
+
# 해당 텍스트가 없으면 아무 작업 안함
|
855
|
+
end
|
856
|
+
|
616
857
|
|
617
858
|
##체크박스1-1 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
618
859
|
puts '-[√] 회원가입 체크박스 1차 탐색.......'.yellow
|
@@ -1468,15 +1709,28 @@ sleep(2)
|
|
1468
1709
|
|
1469
1710
|
|
1470
1711
|
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
1712
|
|
1476
1713
|
|
1477
1714
|
sleep(1)
|
1478
1715
|
##캡챠 이미지,2캡챠,,등등 코드 부분─────────────────────────────────────────────────────────────────────>
|
1479
|
-
|
1716
|
+
#오른쪽 마우스 해제 코드
|
1717
|
+
begin
|
1718
|
+
@driver.execute_script <<-JS
|
1719
|
+
document.querySelectorAll('body').forEach(function(element) {
|
1720
|
+
element.oncontextmenu = null;
|
1721
|
+
});
|
1722
|
+
document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
|
1723
|
+
JS
|
1724
|
+
|
1725
|
+
@driver.execute_script <<-JS
|
1726
|
+
document.addEventListener('contextmenu', function(e) {
|
1727
|
+
e.stopImmediatePropagation();
|
1728
|
+
}, true);
|
1729
|
+
JS
|
1730
|
+
|
1731
|
+
@driver.execute_script("window.oncontextmenu = null;")
|
1732
|
+
rescue
|
1733
|
+
end
|
1480
1734
|
sleep(1)
|
1481
1735
|
##캡챠 이미지,2캡챠,,등등 코드 부분─────────────────────────────────────────────────────────────────────>
|
1482
1736
|
puts '-[√] 캡챠 유형 탐색.......'.green
|
@@ -1575,12 +1829,7 @@ rescue
|
|
1575
1829
|
rescue
|
1576
1830
|
begin
|
1577
1831
|
@driver.switch_to.default_content()
|
1578
|
-
@driver.
|
1579
|
-
if img.attribute('src').include?('kboard_captcha')
|
1580
|
-
el = img # 캡챠 이미지를 el에 저장
|
1581
|
-
break # 첫 번째 이미지를 찾으면 루프 종료
|
1582
|
-
end
|
1583
|
-
end
|
1832
|
+
el = @driver.find_element(:xpath, '//img[contains(@src, "kboard_captcha")]')
|
1584
1833
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1585
1834
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1586
1835
|
puts '-[√] 챕챠 코드 code 5-1.......'.red
|
@@ -1597,11 +1846,13 @@ rescue
|
|
1597
1846
|
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1598
1847
|
sleep(1)
|
1599
1848
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1849
|
+
|
1850
|
+
|
1600
1851
|
rescue
|
1601
1852
|
begin
|
1602
1853
|
@driver.switch_to.default_content()
|
1603
1854
|
#@driver.find_element(:xpath, '//*[@for="kboard-input-captcha"]')
|
1604
|
-
el = @driver.find_element(:
|
1855
|
+
el = @driver.find_element(:xpath, '//*[@for="kboard-input-captcha"] img')
|
1605
1856
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1606
1857
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1607
1858
|
puts '-[√] 챕챠 코드 code 5-2.......'.red
|
@@ -2444,6 +2695,7 @@ end
|
|
2444
2695
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
2445
2696
|
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
2446
2697
|
alert.accept # 알림을 확인
|
2698
|
+
sleep(1)
|
2447
2699
|
rescue
|
2448
2700
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
2449
2701
|
end
|
@@ -2465,58 +2717,69 @@ login_url = option['login_url'].to_s
|
|
2465
2717
|
if login_url == '' or login_url == '로그인 페이지 url'
|
2466
2718
|
|
2467
2719
|
else
|
2468
|
-
|
2720
|
+
@driver.get(login_url)
|
2721
|
+
puts '-[√] 로그인 페이지 URL 이동.......'.magenta
|
2722
|
+
|
2723
|
+
|
2724
|
+
|
2725
|
+
|
2726
|
+
|
2469
2727
|
begin
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
puts '-[√] 로그인 페이지 URL 이동.......'.magenta
|
2475
|
-
# Alert 처리 부분
|
2476
|
-
begin
|
2477
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
2478
|
-
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
2479
|
-
alert.accept # 알림을 확인
|
2480
|
-
rescue
|
2481
|
-
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
2482
|
-
end
|
2483
|
-
|
2484
|
-
rescue Selenium::WebDriver::Error::UnknownError => e
|
2485
|
-
puts "#{login_url} 해당 사이트의 문제로 접속이 불가능합니다." # 오류 메시지 출력
|
2486
|
-
# 열린 모든 창을 닫음
|
2487
|
-
@driver.window_handles.each do |handle|
|
2488
|
-
@driver.switch_to.window(handle)
|
2489
|
-
begin
|
2490
|
-
@driver.close
|
2491
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
2492
|
-
puts "사이트 내부에 예외 발생: #{e.message}"
|
2493
|
-
end
|
2494
|
-
end
|
2495
|
-
|
2496
|
-
# 드라이버 종료
|
2728
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
2729
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
2730
|
+
if error_text
|
2731
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
2497
2732
|
@driver.quit if @driver
|
2498
|
-
return 0
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2733
|
+
return 0
|
2734
|
+
end
|
2735
|
+
rescue
|
2736
|
+
end
|
2737
|
+
|
2738
|
+
begin
|
2739
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
2740
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"Connection timed out")]')
|
2741
|
+
if error_text
|
2742
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
2502
2743
|
@driver.quit if @driver
|
2503
2744
|
return 0
|
2504
|
-
|
2505
|
-
rescue
|
2506
2745
|
end
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2746
|
+
rescue
|
2747
|
+
end
|
2748
|
+
|
2749
|
+
begin
|
2750
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 2) # 3초 대기
|
2751
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
2752
|
+
alert.accept # 알림을 확인
|
2753
|
+
rescue
|
2754
|
+
end
|
2755
|
+
|
2756
|
+
|
2757
|
+
|
2758
|
+
sleep(1)
|
2759
|
+
|
2511
2760
|
##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
2761
|
+
#오른쪽 마우스 해제 코드
|
2762
|
+
begin
|
2763
|
+
@driver.execute_script <<-JS
|
2764
|
+
document.querySelectorAll('body').forEach(function(element) {
|
2765
|
+
element.oncontextmenu = null;
|
2766
|
+
});
|
2767
|
+
document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
|
2768
|
+
JS
|
2512
2769
|
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2770
|
+
@driver.execute_script <<-JS
|
2771
|
+
document.addEventListener('contextmenu', function(e) {
|
2772
|
+
e.stopImmediatePropagation();
|
2773
|
+
}, true);
|
2774
|
+
JS
|
2775
|
+
|
2776
|
+
@driver.execute_script("window.oncontextmenu = null;")
|
2777
|
+
rescue
|
2778
|
+
end
|
2779
|
+
|
2780
|
+
sleep(5)
|
2781
|
+
|
2782
|
+
|
2520
2783
|
begin
|
2521
2784
|
@driver.find_element(:xpath, '//*[@class="amzn-captcha-state-container"]')
|
2522
2785
|
puts '-[√] 아임웹 캡챠 확인!! 해제 실행.......'.green
|
@@ -2612,7 +2875,7 @@ login_url = option['login_url'].to_s
|
|
2612
2875
|
rescue
|
2613
2876
|
begin
|
2614
2877
|
# 타임아웃을 3초로 설정
|
2615
|
-
wait = Selenium::WebDriver::Wait.new(:timeout =>
|
2878
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 2)
|
2616
2879
|
# 요소가 나타날 때까지 30초 동안 기다립니다.
|
2617
2880
|
wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
|
2618
2881
|
sleep(1)
|
@@ -2700,7 +2963,7 @@ login_url = option['login_url'].to_s
|
|
2700
2963
|
|
2701
2964
|
|
2702
2965
|
begin
|
2703
|
-
|
2966
|
+
|
2704
2967
|
chat_box = @driver.find_element(:xpath, '//*[@class="adsbygoogle adsbygoogle-noablate"]')
|
2705
2968
|
@driver.execute_script("arguments[0].remove();", chat_box)
|
2706
2969
|
puts '-[√] 숨김 code 1 제거 완료.......'.green
|
@@ -2709,7 +2972,7 @@ login_url = option['login_url'].to_s
|
|
2709
2972
|
end
|
2710
2973
|
|
2711
2974
|
begin
|
2712
|
-
|
2975
|
+
|
2713
2976
|
chat_box = @driver.find_element(:xpath, '//*[@class="google-auto-placed"]')
|
2714
2977
|
@driver.execute_script("arguments[0].remove();", chat_box)
|
2715
2978
|
puts '-[√] 숨김 code 2 제거 완료.......'.green
|
@@ -2718,7 +2981,7 @@ login_url = option['login_url'].to_s
|
|
2718
2981
|
end
|
2719
2982
|
|
2720
2983
|
begin
|
2721
|
-
|
2984
|
+
|
2722
2985
|
chat_box = @driver.find_elements(:xpath, '//*[@class="adsbygoogle adsbygoogle-noablate"]')[1]
|
2723
2986
|
@driver.execute_script("arguments[0].remove();", chat_box)
|
2724
2987
|
puts '-[√] 숨김 code 3 제거 완료.......'.green
|
@@ -2727,7 +2990,7 @@ login_url = option['login_url'].to_s
|
|
2727
2990
|
end
|
2728
2991
|
|
2729
2992
|
begin
|
2730
|
-
|
2993
|
+
|
2731
2994
|
chat_box = @driver.find_elements(:xpath, '//*[@class="adsbygoogle adsbygoogle-noablate"]')[2]
|
2732
2995
|
@driver.execute_script("arguments[0].remove();", chat_box)
|
2733
2996
|
puts '-[√] 숨김 code 4 제거 완료.......'.green
|
@@ -2736,7 +2999,7 @@ login_url = option['login_url'].to_s
|
|
2736
2999
|
end
|
2737
3000
|
|
2738
3001
|
begin
|
2739
|
-
|
3002
|
+
|
2740
3003
|
chat_box = @driver.find_elements(:xpath, '//*[@class="adsbygoogle adsbygoogle-noablate"]')[3]
|
2741
3004
|
@driver.execute_script("arguments[0].remove();", chat_box)
|
2742
3005
|
puts '-[√] 숨김 code 5 제거 완료.......'.green
|
@@ -2757,11 +3020,10 @@ login_url = option['login_url'].to_s
|
|
2757
3020
|
rescue
|
2758
3021
|
end
|
2759
3022
|
|
2760
|
-
|
2761
3023
|
|
2762
3024
|
|
2763
3025
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
2764
|
-
|
3026
|
+
|
2765
3027
|
|
2766
3028
|
begin
|
2767
3029
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
@@ -2843,7 +3105,7 @@ login_url = option['login_url'].to_s
|
|
2843
3105
|
@driver.find_element(:xpath, '//*[@id="hd_pops_1"]/div[2]/button[1]').click
|
2844
3106
|
sleep(1)
|
2845
3107
|
rescue
|
2846
|
-
|
3108
|
+
|
2847
3109
|
|
2848
3110
|
end
|
2849
3111
|
|
@@ -2873,7 +3135,7 @@ login_url = option['login_url'].to_s
|
|
2873
3135
|
|
2874
3136
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
2875
3137
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
2876
|
-
|
3138
|
+
|
2877
3139
|
|
2878
3140
|
begin
|
2879
3141
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
@@ -2955,7 +3217,7 @@ login_url = option['login_url'].to_s
|
|
2955
3217
|
@driver.find_element(:xpath, '//*[@id="hd_pops_2"]/div[2]/button[1]').click
|
2956
3218
|
sleep(1)
|
2957
3219
|
rescue
|
2958
|
-
|
3220
|
+
|
2959
3221
|
|
2960
3222
|
end
|
2961
3223
|
|
@@ -2985,7 +3247,7 @@ login_url = option['login_url'].to_s
|
|
2985
3247
|
end
|
2986
3248
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
2987
3249
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
2988
|
-
|
3250
|
+
|
2989
3251
|
|
2990
3252
|
begin
|
2991
3253
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
@@ -3067,7 +3329,7 @@ login_url = option['login_url'].to_s
|
|
3067
3329
|
@driver.find_element(:xpath, '//*[@id="hd_pops_3"]/div[2]/button[1]').click
|
3068
3330
|
sleep(1)
|
3069
3331
|
rescue
|
3070
|
-
|
3332
|
+
|
3071
3333
|
|
3072
3334
|
end
|
3073
3335
|
|
@@ -3097,7 +3359,7 @@ login_url = option['login_url'].to_s
|
|
3097
3359
|
end
|
3098
3360
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
3099
3361
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
3100
|
-
|
3362
|
+
|
3101
3363
|
|
3102
3364
|
begin
|
3103
3365
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
@@ -3179,7 +3441,7 @@ login_url = option['login_url'].to_s
|
|
3179
3441
|
@driver.find_element(:xpath, '//*[@id="hd_pops_4"]/div[2]/button[1]').click
|
3180
3442
|
sleep(1)
|
3181
3443
|
rescue
|
3182
|
-
|
3444
|
+
|
3183
3445
|
|
3184
3446
|
end
|
3185
3447
|
|
@@ -3209,7 +3471,7 @@ login_url = option['login_url'].to_s
|
|
3209
3471
|
end
|
3210
3472
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
3211
3473
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
3212
|
-
|
3474
|
+
|
3213
3475
|
|
3214
3476
|
begin
|
3215
3477
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
@@ -3291,7 +3553,7 @@ login_url = option['login_url'].to_s
|
|
3291
3553
|
@driver.find_element(:xpath, '//*[@id="hd_pops_5"]/div[2]/button[1]').click
|
3292
3554
|
sleep(1)
|
3293
3555
|
rescue
|
3294
|
-
|
3556
|
+
|
3295
3557
|
|
3296
3558
|
end
|
3297
3559
|
|
@@ -3321,10 +3583,20 @@ login_url = option['login_url'].to_s
|
|
3321
3583
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
3322
3584
|
|
3323
3585
|
|
3324
|
-
|
3586
|
+
begin
|
3587
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
3588
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
3589
|
+
if error_text
|
3590
|
+
puts '사이트에 연결할 수 없음 텍스트가 발견되었습니다. 창을 닫습니다.'
|
3591
|
+
@driver.quit if @driver
|
3592
|
+
return 0
|
3593
|
+
end
|
3594
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
3595
|
+
# 해당 텍스트가 없으면 아무 작업 안함
|
3596
|
+
end
|
3325
3597
|
|
3326
3598
|
##아이디 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
3327
|
-
|
3599
|
+
|
3328
3600
|
sleep(1)
|
3329
3601
|
begin
|
3330
3602
|
@driver.find_element(:xpath, '//*[@name="mb_id"]').send_keys(user_id)
|
@@ -3421,20 +3693,7 @@ login_url = option['login_url'].to_s
|
|
3421
3693
|
begin
|
3422
3694
|
@driver.find_element(:xpath, '//*[@class="username"]').send_keys(user_id)
|
3423
3695
|
sleep(3)
|
3424
|
-
rescue
|
3425
|
-
puts '-[√] 로그인 페이지 접속 시도 실패 (페이지 로딩 지연 및 접속 불량).......'.red
|
3426
|
-
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
3427
|
-
@driver.window_handles.each do |handle|
|
3428
|
-
@driver.switch_to.window(handle)
|
3429
|
-
begin
|
3430
|
-
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
3431
|
-
@driver.close
|
3432
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
3433
|
-
puts "크롬 브라우저 종료: #{e.message}"
|
3434
|
-
end
|
3435
|
-
end
|
3436
|
-
return 0
|
3437
|
-
@driver.quit
|
3696
|
+
rescue
|
3438
3697
|
end
|
3439
3698
|
|
3440
3699
|
end
|
@@ -3555,7 +3814,7 @@ login_url = option['login_url'].to_s
|
|
3555
3814
|
end
|
3556
3815
|
end
|
3557
3816
|
end
|
3558
|
-
|
3817
|
+
|
3559
3818
|
sleep(1)
|
3560
3819
|
end
|
3561
3820
|
##패스워드 입력 코드 부분─────────────────────────────────────────────────────────────────────<
|
@@ -3594,47 +3853,53 @@ login_url = option['login_url'].to_s
|
|
3594
3853
|
sleep(3)
|
3595
3854
|
rescue
|
3596
3855
|
begin
|
3597
|
-
@driver.find_element(:xpath, '//*[@
|
3856
|
+
@driver.find_element(:xpath, '//*[@class="btn btn-color pull-right"]').click
|
3598
3857
|
puts '-[√] 로그인 버튼 코드 7 타겟.......'.cyan
|
3599
3858
|
sleep(3)
|
3600
3859
|
rescue
|
3601
3860
|
begin
|
3602
|
-
@driver.find_element(:xpath, '//*[@
|
3861
|
+
@driver.find_element(:xpath, '//*[@alt="로그인"]').click
|
3603
3862
|
puts '-[√] 로그인 버튼 코드 8 타겟.......'.cyan
|
3604
3863
|
sleep(3)
|
3605
3864
|
rescue
|
3606
3865
|
begin
|
3607
|
-
@driver.find_element(:xpath, '//*[@id="
|
3866
|
+
@driver.find_element(:xpath, '//*[@id="mb_login"]/form/div[5]/button').click
|
3608
3867
|
puts '-[√] 로그인 버튼 코드 9 타겟.......'.cyan
|
3609
3868
|
sleep(3)
|
3610
3869
|
rescue
|
3611
3870
|
begin
|
3612
|
-
@driver.find_element(:xpath, '//*[@
|
3871
|
+
@driver.find_element(:xpath, '//*[@id="ol_submit"]').click
|
3613
3872
|
puts '-[√] 로그인 버튼 코드 10 타겟.......'.cyan
|
3614
3873
|
sleep(3)
|
3615
3874
|
rescue
|
3616
3875
|
begin
|
3617
|
-
@driver.find_element(:xpath, '//*[@
|
3876
|
+
@driver.find_element(:xpath, '//*[@alt="login"]').click
|
3618
3877
|
puts '-[√] 로그인 버튼 코드 11 타겟.......'.cyan
|
3619
3878
|
sleep(3)
|
3620
3879
|
rescue
|
3621
3880
|
begin
|
3622
|
-
@driver.find_element(:xpath, '//*[@
|
3881
|
+
@driver.find_element(:xpath, '//*[@title="login"]').click
|
3623
3882
|
puts '-[√] 로그인 버튼 코드 12 타겟.......'.cyan
|
3624
3883
|
sleep(3)
|
3625
3884
|
rescue
|
3626
3885
|
begin
|
3627
|
-
@driver.find_element(:xpath, '//*[@id="
|
3886
|
+
@driver.find_element(:xpath, '//*[@id="signIn_1"]').click
|
3628
3887
|
puts '-[√] 로그인 버튼 코드 13 타겟.......'.cyan
|
3629
3888
|
sleep(3)
|
3630
3889
|
rescue
|
3631
3890
|
begin
|
3632
|
-
@driver.find_element(:xpath, '//*[@
|
3891
|
+
@driver.find_element(:xpath, '//*[@id="btn_login"]').click
|
3633
3892
|
puts '-[√] 로그인 버튼 코드 14 타겟.......'.cyan
|
3634
3893
|
sleep(3)
|
3635
3894
|
rescue
|
3636
|
-
|
3637
|
-
|
3895
|
+
begin
|
3896
|
+
@driver.find_element(:xpath, '//*[@name="wp-submit"]').click
|
3897
|
+
puts '-[√] 로그인 버튼 코드 15 타겟.......'.cyan
|
3898
|
+
sleep(3)
|
3899
|
+
rescue
|
3900
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
3901
|
+
sleep(3)
|
3902
|
+
end
|
3638
3903
|
end
|
3639
3904
|
end
|
3640
3905
|
end
|
@@ -3651,11 +3916,14 @@ login_url = option['login_url'].to_s
|
|
3651
3916
|
end
|
3652
3917
|
##로그인 버튼 코드 부분─────────────────────────────────────────────────────────────────────<
|
3653
3918
|
|
3919
|
+
|
3920
|
+
|
3654
3921
|
# Alert 처리 부분
|
3655
3922
|
begin
|
3656
3923
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
3657
3924
|
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3658
3925
|
alert.accept # 알림을 확인
|
3926
|
+
sleep(1)
|
3659
3927
|
rescue
|
3660
3928
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
3661
3929
|
end
|
@@ -3666,7 +3934,7 @@ login_url = option['login_url'].to_s
|
|
3666
3934
|
|
3667
3935
|
|
3668
3936
|
rescue => e
|
3669
|
-
puts '-[√] 로그인 PASS.......'.cyan
|
3937
|
+
#puts '-[√] 로그인 PASS.......'.cyan
|
3670
3938
|
puts e
|
3671
3939
|
end
|
3672
3940
|
|
@@ -3684,57 +3952,68 @@ begin
|
|
3684
3952
|
|
3685
3953
|
else
|
3686
3954
|
|
3955
|
+
@driver.get(cc_check_url)
|
3956
|
+
puts '-[√] 출석 체크 페이지 URL 이동.......'.magenta
|
3957
|
+
|
3958
|
+
|
3959
|
+
|
3960
|
+
|
3961
|
+
|
3687
3962
|
begin
|
3688
|
-
|
3689
|
-
|
3690
|
-
|
3691
|
-
|
3692
|
-
puts '-[√] 출석체크 페이지 URL 이동.......'.magenta
|
3693
|
-
# Alert 처리 부분
|
3694
|
-
begin
|
3695
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
3696
|
-
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3697
|
-
alert.accept # 알림을 확인
|
3698
|
-
rescue
|
3699
|
-
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
3700
|
-
end
|
3701
|
-
|
3702
|
-
rescue Selenium::WebDriver::Error::UnknownError => e
|
3703
|
-
puts "#{cc_check_url} 해당 사이트의 문제로 접속이 불가능합니다." # 오류 메시지 출력
|
3704
|
-
# 열린 모든 창을 닫음
|
3705
|
-
@driver.window_handles.each do |handle|
|
3706
|
-
@driver.switch_to.window(handle)
|
3707
|
-
begin
|
3708
|
-
@driver.close
|
3709
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
3710
|
-
puts "사이트 내부에 예외 발생: #{e.message}"
|
3711
|
-
end
|
3712
|
-
end
|
3713
|
-
|
3714
|
-
# 드라이버 종료
|
3963
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
3964
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
3965
|
+
if error_text
|
3966
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
3715
3967
|
@driver.quit if @driver
|
3716
|
-
return 0
|
3717
|
-
|
3718
|
-
|
3719
|
-
|
3968
|
+
return 0
|
3969
|
+
end
|
3970
|
+
rescue
|
3971
|
+
end
|
3972
|
+
|
3973
|
+
begin
|
3974
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
3975
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"Connection timed out")]')
|
3976
|
+
if error_text
|
3977
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
3720
3978
|
@driver.quit if @driver
|
3721
3979
|
return 0
|
3722
|
-
|
3723
|
-
rescue
|
3724
3980
|
end
|
3981
|
+
rescue
|
3982
|
+
end
|
3725
3983
|
|
3726
|
-
|
3984
|
+
begin
|
3985
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 2) # 3초 대기
|
3986
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3987
|
+
alert.accept # 알림을 확인
|
3988
|
+
rescue
|
3989
|
+
end
|
3727
3990
|
|
3991
|
+
|
3728
3992
|
|
3729
3993
|
sleep(1)
|
3994
|
+
#오른쪽 마우스 해제 코드
|
3995
|
+
begin
|
3996
|
+
@driver.execute_script <<-JS
|
3997
|
+
document.querySelectorAll('body').forEach(function(element) {
|
3998
|
+
element.oncontextmenu = null;
|
3999
|
+
});
|
4000
|
+
document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
|
4001
|
+
JS
|
4002
|
+
|
4003
|
+
@driver.execute_script <<-JS
|
4004
|
+
document.addEventListener('contextmenu', function(e) {
|
4005
|
+
e.stopImmediatePropagation();
|
4006
|
+
}, true);
|
4007
|
+
JS
|
4008
|
+
|
4009
|
+
@driver.execute_script("window.oncontextmenu = null;")
|
4010
|
+
rescue
|
4011
|
+
end
|
3730
4012
|
##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
3731
4013
|
begin
|
3732
|
-
|
3733
|
-
|
3734
|
-
|
3735
|
-
sleep(1)
|
3736
|
-
puts '-[√] 3 캡챠 발생 유무 확인.......'.green
|
3737
|
-
sleep(1)
|
4014
|
+
sleep(5)
|
4015
|
+
|
4016
|
+
|
3738
4017
|
# 타임아웃을 3초로 설정
|
3739
4018
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
3740
4019
|
# 요소가 나타날 때까지 30초 동안 기다립니다.
|
@@ -3773,7 +4052,7 @@ begin
|
|
3773
4052
|
end
|
3774
4053
|
##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
|
3775
4054
|
|
3776
|
-
|
4055
|
+
begin
|
3777
4056
|
# 요소 찾기 타임아웃을 10초로 설정
|
3778
4057
|
wait = Selenium::WebDriver::Wait.new(:timeout => 20)
|
3779
4058
|
#요소가 나타날 때까지 20초 동안 기다립니다.
|
@@ -3798,6 +4077,19 @@ begin
|
|
3798
4077
|
end
|
3799
4078
|
end
|
3800
4079
|
|
4080
|
+
begin
|
4081
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
4082
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
4083
|
+
if error_text
|
4084
|
+
puts '사이트에 연결할 수 없음 텍스트가 발견되었습니다. 창을 닫습니다.'
|
4085
|
+
@driver.quit if @driver
|
4086
|
+
return 0
|
4087
|
+
end
|
4088
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
4089
|
+
# 해당 텍스트가 없으면 아무 작업 안함
|
4090
|
+
end
|
4091
|
+
|
4092
|
+
|
3801
4093
|
##출석 체크 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
3802
4094
|
cctxt_value = ['ㅊㅊ','출석체크','출석 체크해요','출첵~','추추','출석~','출석 체크 하고 가요','출석 체크 합니다.','안녕하세요','출첵왔어요','출석체크합니다.','출석체크~','출석했어요','출첵!!','출석 체크~,','출석 도장 쾅~!','출석 도장 쾅쾅!!','출석 하고 가요','출첵^^*','출석 체크~!^^','^^','^*^','출첵*_*','추추^^*'].sample
|
3803
4095
|
begin
|
@@ -3908,6 +4200,7 @@ begin
|
|
3908
4200
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
3909
4201
|
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3910
4202
|
alert.accept # 알림을 확인
|
4203
|
+
sleep(1)
|
3911
4204
|
rescue
|
3912
4205
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
3913
4206
|
end
|
@@ -3924,71 +4217,67 @@ end
|
|
3924
4217
|
|
3925
4218
|
|
3926
4219
|
|
3927
|
-
|
4220
|
+
post_url = option['post_url'].to_s
|
3928
4221
|
|
3929
4222
|
begin
|
3930
4223
|
if post_url == '' or post_url == '게시판 글쓰기 url'
|
3931
4224
|
|
3932
4225
|
else
|
3933
|
-
|
4226
|
+
@driver.get(post_url)
|
4227
|
+
puts '-[√] 게시판 페이지 URL 이동.......'.magenta
|
4228
|
+
|
4229
|
+
|
4230
|
+
|
4231
|
+
|
4232
|
+
|
3934
4233
|
begin
|
3935
|
-
|
3936
|
-
|
3937
|
-
|
3938
|
-
|
3939
|
-
puts '-[√] 글쓰기 페이지 URL 이동.......'.magenta
|
3940
|
-
# Alert 처리 부분
|
3941
|
-
begin
|
3942
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
3943
|
-
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3944
|
-
alert.accept # 알림을 확인
|
3945
|
-
rescue
|
3946
|
-
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
3947
|
-
end
|
3948
|
-
|
3949
|
-
rescue Selenium::WebDriver::Error::UnknownError => e
|
3950
|
-
puts "#{post_url} 해당 사이트의 문제로 접속이 불가능합니다." # 오류 메시지 출력
|
3951
|
-
# 열린 모든 창을 닫음
|
3952
|
-
@driver.window_handles.each do |handle|
|
3953
|
-
@driver.switch_to.window(handle)
|
3954
|
-
begin
|
3955
|
-
@driver.close
|
3956
|
-
rescue Selenium::WebDriver::Error::WebDriverError => e
|
3957
|
-
puts "사이트 내부에 예외 발생: #{e.message}"
|
3958
|
-
end
|
3959
|
-
end
|
3960
|
-
|
3961
|
-
# 드라이버 종료
|
3962
|
-
@driver.quit if @driver
|
3963
|
-
return 0
|
3964
|
-
|
3965
|
-
rescue Selenium::WebDriver::Error::TimeoutError => e
|
3966
|
-
puts "웹 페이지 로드가 시간 초과되었습니다: #{e.message}"
|
4234
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
4235
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
4236
|
+
if error_text
|
4237
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
3967
4238
|
@driver.quit if @driver
|
3968
4239
|
return 0
|
3969
|
-
|
3970
|
-
rescue
|
3971
4240
|
end
|
4241
|
+
rescue
|
4242
|
+
end
|
3972
4243
|
|
4244
|
+
begin
|
4245
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
4246
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"Connection timed out")]')
|
4247
|
+
if error_text
|
4248
|
+
puts '사이트 문제 발견!! 사이트에 접근할수 없습니다 창을 닫습니다.'
|
4249
|
+
@driver.quit if @driver
|
4250
|
+
return 0
|
4251
|
+
end
|
4252
|
+
rescue
|
4253
|
+
end
|
3973
4254
|
|
4255
|
+
begin
|
4256
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 2) # 3초 대기
|
4257
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
4258
|
+
alert.accept # 알림을 확인
|
4259
|
+
rescue
|
4260
|
+
end
|
3974
4261
|
|
3975
|
-
|
4262
|
+
|
3976
4263
|
sleep(1)
|
4264
|
+
|
4265
|
+
|
3977
4266
|
begin
|
3978
|
-
|
4267
|
+
|
3979
4268
|
el_post_btn = @driver.find_element(:xpath, '//*[@class="btn btn-primary btn-sm float_r"]')
|
3980
4269
|
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
|
3981
4270
|
sleep(1)
|
3982
4271
|
@driver.find_element(:xpath, '//*[@class="btn btn-primary btn-sm float_r"]').click
|
3983
4272
|
sleep(3.7)
|
3984
|
-
puts '-[√] 글쓰기 버튼 code 1
|
4273
|
+
puts '-[√] 글쓰기 버튼 클릭 확인 code 1 타겟.......'.green
|
3985
4274
|
rescue
|
3986
4275
|
begin
|
3987
4276
|
el_post_btn = @driver.find_element(:xpath, '//*[@class="btn-block-right"]')
|
3988
4277
|
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
|
3989
4278
|
sleep(1)
|
3990
4279
|
@driver.find_element(:xpath, '//*[@class="btn-block-right"]').click
|
3991
|
-
puts '-[√] 글쓰기 버튼 code 2
|
4280
|
+
puts '-[√] 글쓰기 버튼 클릭 확인 code 2 타겟.......'.green
|
3992
4281
|
sleep(3.7)
|
3993
4282
|
rescue
|
3994
4283
|
begin
|
@@ -3996,7 +4285,7 @@ login_url = option['login_url'].to_s
|
|
3996
4285
|
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
|
3997
4286
|
sleep(1)
|
3998
4287
|
@driver.find_element(:xpath, '//*[@class="write_btn"]').click
|
3999
|
-
puts '-[√] 글쓰기 버튼 code 3
|
4288
|
+
puts '-[√] 글쓰기 버튼 클릭 확인 code 3 타겟.......'.green
|
4000
4289
|
sleep(3.7)
|
4001
4290
|
rescue
|
4002
4291
|
begin
|
@@ -4004,7 +4293,7 @@ login_url = option['login_url'].to_s
|
|
4004
4293
|
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
|
4005
4294
|
sleep(1)
|
4006
4295
|
@driver.find_element(:xpath, '//*[@class="gRight"]').click
|
4007
|
-
puts '-[√] 글쓰기 버튼 code 4
|
4296
|
+
puts '-[√] 글쓰기 버튼 클릭 확인 code 4 타겟.......'.green
|
4008
4297
|
sleep(3.7)
|
4009
4298
|
rescue
|
4010
4299
|
|
@@ -4012,18 +4301,33 @@ login_url = option['login_url'].to_s
|
|
4012
4301
|
end
|
4013
4302
|
end
|
4014
4303
|
end
|
4015
|
-
|
4304
|
+
|
4016
4305
|
sleep(1)
|
4306
|
+
#오른쪽 마우스 해제 코드
|
4307
|
+
begin
|
4308
|
+
@driver.execute_script <<-JS
|
4309
|
+
document.querySelectorAll('body').forEach(function(element) {
|
4310
|
+
element.oncontextmenu = null;
|
4311
|
+
});
|
4312
|
+
document.removeEventListener('contextmenu', function(e) { e.preventDefault(); }, false);
|
4313
|
+
JS
|
4314
|
+
|
4315
|
+
@driver.execute_script <<-JS
|
4316
|
+
document.addEventListener('contextmenu', function(e) {
|
4317
|
+
e.stopImmediatePropagation();
|
4318
|
+
}, true);
|
4319
|
+
JS
|
4017
4320
|
|
4018
|
-
|
4321
|
+
@driver.execute_script("window.oncontextmenu = null;")
|
4322
|
+
rescue
|
4323
|
+
end
|
4324
|
+
|
4325
|
+
##캡챠 해제 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
4019
4326
|
|
4020
|
-
puts '-[√] 1 캡챠 발생 유무 확인.......'.green
|
4021
|
-
sleep(1)
|
4022
|
-
puts '-[√] 2 캡챠 발생 유무 확인.......'.green
|
4023
|
-
sleep(1)
|
4024
|
-
puts '-[√] 3 캡챠 발생 유무 확인.......'.green
|
4025
|
-
sleep(1)
|
4026
4327
|
|
4328
|
+
sleep(5)
|
4329
|
+
|
4330
|
+
|
4027
4331
|
begin
|
4028
4332
|
@driver.find_element(:xpath, '//*[@class="amzn-captcha-state-container"]')
|
4029
4333
|
puts '-[√] 아임웹 캡챠 확인!! 해제 실행.......'.green
|
@@ -4161,7 +4465,7 @@ login_url = option['login_url'].to_s
|
|
4161
4465
|
end
|
4162
4466
|
end
|
4163
4467
|
rescue
|
4164
|
-
|
4468
|
+
|
4165
4469
|
end
|
4166
4470
|
end
|
4167
4471
|
end
|
@@ -4200,6 +4504,7 @@ login_url = option['login_url'].to_s
|
|
4200
4504
|
rescue => e
|
4201
4505
|
begin
|
4202
4506
|
@driver.switch_to.alert.accept
|
4507
|
+
sleep(1)
|
4203
4508
|
rescue
|
4204
4509
|
end
|
4205
4510
|
puts '-[√] 글쓰기 페이지 접속 시도 실패 (페이지 로딩 지연 및 접속 불량).......'.red
|
@@ -4215,7 +4520,20 @@ login_url = option['login_url'].to_s
|
|
4215
4520
|
sleep(2)
|
4216
4521
|
rescue
|
4217
4522
|
end
|
4218
|
-
|
4523
|
+
|
4524
|
+
begin
|
4525
|
+
# 이 부분을 통해 페이지 내에서 "사이트에 연결할 수 없음" 텍스트를 찾습니다.
|
4526
|
+
error_text = @driver.find_element(:xpath, '//*[contains(text(),"사이트에 연결할 수 없음")]')
|
4527
|
+
if error_text
|
4528
|
+
puts '사이트에 연결할 수 없음 텍스트가 발견되었습니다. 창을 닫습니다.'
|
4529
|
+
@driver.quit if @driver
|
4530
|
+
return 0
|
4531
|
+
end
|
4532
|
+
rescue Selenium::WebDriver::Error::NoSuchElementError
|
4533
|
+
# 해당 텍스트가 없으면 아무 작업 안함
|
4534
|
+
end
|
4535
|
+
|
4536
|
+
|
4219
4537
|
|
4220
4538
|
begin
|
4221
4539
|
chat_box = @driver.find_element(:xpath, '//*[@class="adsbygoogle adsbygoogle-noablate"]')
|
@@ -4354,63 +4672,77 @@ login_url = option['login_url'].to_s
|
|
4354
4672
|
|
4355
4673
|
|
4356
4674
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
4357
|
-
|
4675
|
+
|
4358
4676
|
|
4359
4677
|
begin
|
4360
4678
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4361
4679
|
sleep(1)
|
4680
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4362
4681
|
rescue
|
4363
4682
|
begin
|
4364
4683
|
@driver.find_element(:xpath, '//*[@class="permanentClose"]').click
|
4365
4684
|
sleep(1)
|
4685
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4366
4686
|
rescue
|
4367
4687
|
begin
|
4368
4688
|
@driver.find_element(:xpath, '//*[@class="close"]').click
|
4369
4689
|
sleep(1)
|
4690
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4370
4691
|
rescue
|
4371
4692
|
begin
|
4372
4693
|
@driver.find_element(:partial_link_text, '닫기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4373
4694
|
sleep(1)
|
4695
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4374
4696
|
rescue
|
4375
4697
|
begin
|
4376
4698
|
@driver.find_element(:xpath, '//*[@class="fas fa-angle-down"]').click
|
4377
4699
|
sleep(1)
|
4700
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4378
4701
|
rescue
|
4379
4702
|
begin
|
4380
4703
|
@driver.find_element(:xpath, '//*[@class="fa fa-check-square-o"]').click
|
4381
4704
|
sleep(1)
|
4705
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4382
4706
|
rescue
|
4383
4707
|
begin
|
4384
4708
|
@driver.find_element(:xpath, '//*[@title="Close"]').click
|
4385
4709
|
sleep(1)
|
4710
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4386
4711
|
rescue
|
4387
4712
|
begin
|
4388
4713
|
@driver.find_element(:xpath, '//*[@alt="Close"]').click
|
4389
4714
|
sleep(1)
|
4715
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4390
4716
|
rescue
|
4391
4717
|
begin
|
4392
4718
|
@driver.find_element(:xpath, '//*[@class="sgpb-popup-close-button-1"]').click
|
4393
4719
|
sleep(1)
|
4720
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4394
4721
|
rescue
|
4395
4722
|
begin
|
4396
4723
|
@driver.find_element(:partial_link_text, '시간 동안 다시 열람하지 않습니다.').click
|
4397
4724
|
sleep(1)
|
4725
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4398
4726
|
rescue
|
4399
4727
|
begin
|
4400
4728
|
@driver.find_element(:xpath, '//*[@class="btn skip"]').click
|
4401
4729
|
sleep(1)
|
4730
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4402
4731
|
rescue
|
4403
4732
|
begin
|
4404
4733
|
@driver.find_element(:xpath, '//*[@stroke="#FAFAFA"]').click
|
4405
4734
|
sleep(1)
|
4735
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4406
4736
|
rescue
|
4407
4737
|
begin
|
4408
4738
|
@driver.find_element(:xpath, '//*[@fill="#FAFAFA"]').click
|
4409
4739
|
sleep(1)
|
4740
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4410
4741
|
rescue
|
4411
4742
|
begin
|
4412
4743
|
@driver.find_element(:xpath, '//*[@stroke-linecap="square"]').click
|
4413
4744
|
sleep(1)
|
4745
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4414
4746
|
rescue
|
4415
4747
|
begin
|
4416
4748
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="Advertisement"]'))
|
@@ -4419,29 +4751,35 @@ login_url = option['login_url'].to_s
|
|
4419
4751
|
sleep(1)
|
4420
4752
|
@driver.switch_to.default_content()
|
4421
4753
|
sleep(1)
|
4754
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4422
4755
|
rescue
|
4423
4756
|
begin
|
4424
4757
|
@driver.find_element(:xpath, '//*[@id="footer-btn-icon"]').click
|
4425
4758
|
sleep(1)
|
4759
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4426
4760
|
rescue
|
4427
4761
|
begin
|
4428
4762
|
@driver.find_element(:xpath, '//*[@id="dismiss-button"]').click
|
4429
4763
|
sleep(1)
|
4764
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4430
4765
|
rescue
|
4431
4766
|
begin
|
4432
4767
|
@driver.find_element(:xpath, '//*[@id="banner"]/div[1]/div/div[1]').click
|
4433
4768
|
sleep(1)
|
4769
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4434
4770
|
rescue
|
4435
4771
|
|
4436
4772
|
begin
|
4437
4773
|
@driver.find_element(:xpath, '//*[@id="hd_pops_1"]/div[2]/button[1]').click
|
4438
4774
|
sleep(1)
|
4775
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4439
4776
|
rescue
|
4440
4777
|
begin
|
4441
4778
|
@driver.find_element(:xpath, '//*[@class="modal_close"]').click
|
4442
4779
|
sleep(1)
|
4780
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4443
4781
|
rescue
|
4444
|
-
|
4782
|
+
|
4445
4783
|
|
4446
4784
|
end
|
4447
4785
|
|
@@ -4472,63 +4810,77 @@ login_url = option['login_url'].to_s
|
|
4472
4810
|
|
4473
4811
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
4474
4812
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
4475
|
-
|
4813
|
+
|
4476
4814
|
|
4477
4815
|
begin
|
4478
4816
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4479
4817
|
sleep(1)
|
4818
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4480
4819
|
rescue
|
4481
4820
|
begin
|
4482
4821
|
@driver.find_element(:xpath, '//*[@class="permanentClose"]').click
|
4483
4822
|
sleep(1)
|
4823
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4484
4824
|
rescue
|
4485
4825
|
begin
|
4486
4826
|
@driver.find_element(:xpath, '//*[@class="close"]').click
|
4487
4827
|
sleep(1)
|
4828
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4488
4829
|
rescue
|
4489
4830
|
begin
|
4490
4831
|
@driver.find_element(:partial_link_text, '닫기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4491
4832
|
sleep(1)
|
4833
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4492
4834
|
rescue
|
4493
4835
|
begin
|
4494
4836
|
@driver.find_element(:xpath, '//*[@class="fas fa-angle-down"]').click
|
4495
4837
|
sleep(1)
|
4838
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4496
4839
|
rescue
|
4497
4840
|
begin
|
4498
4841
|
@driver.find_element(:xpath, '//*[@class="fa fa-check-square-o"]').click
|
4499
4842
|
sleep(1)
|
4843
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4500
4844
|
rescue
|
4501
4845
|
begin
|
4502
4846
|
@driver.find_element(:xpath, '//*[@title="Close"]').click
|
4503
4847
|
sleep(1)
|
4848
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4504
4849
|
rescue
|
4505
4850
|
begin
|
4506
4851
|
@driver.find_element(:xpath, '//*[@alt="Close"]').click
|
4507
4852
|
sleep(1)
|
4853
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4508
4854
|
rescue
|
4509
4855
|
begin
|
4510
4856
|
@driver.find_element(:xpath, '//*[@class="sgpb-popup-close-button-1"]').click
|
4511
4857
|
sleep(1)
|
4858
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4512
4859
|
rescue
|
4513
4860
|
begin
|
4514
4861
|
@driver.find_element(:partial_link_text, '시간 동안 다시 열람하지 않습니다.').click
|
4515
4862
|
sleep(1)
|
4863
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4516
4864
|
rescue
|
4517
4865
|
begin
|
4518
4866
|
@driver.find_element(:xpath, '//*[@class="btn skip"]').click
|
4519
4867
|
sleep(1)
|
4868
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4520
4869
|
rescue
|
4521
4870
|
begin
|
4522
4871
|
@driver.find_element(:xpath, '//*[@stroke="#FAFAFA"]').click
|
4523
4872
|
sleep(1)
|
4873
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4524
4874
|
rescue
|
4525
4875
|
begin
|
4526
4876
|
@driver.find_element(:xpath, '//*[@fill="#FAFAFA"]').click
|
4527
4877
|
sleep(1)
|
4878
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4528
4879
|
rescue
|
4529
4880
|
begin
|
4530
4881
|
@driver.find_element(:xpath, '//*[@stroke-linecap="square"]').click
|
4531
4882
|
sleep(1)
|
4883
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4532
4884
|
rescue
|
4533
4885
|
begin
|
4534
4886
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="Advertisement"]'))
|
@@ -4537,25 +4889,29 @@ login_url = option['login_url'].to_s
|
|
4537
4889
|
sleep(1)
|
4538
4890
|
@driver.switch_to.default_content()
|
4539
4891
|
sleep(1)
|
4892
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4540
4893
|
rescue
|
4541
4894
|
begin
|
4542
4895
|
@driver.find_element(:xpath, '//*[@id="footer-btn-icon"]').click
|
4543
4896
|
sleep(1)
|
4897
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4544
4898
|
rescue
|
4545
4899
|
begin
|
4546
4900
|
@driver.find_element(:xpath, '//*[@id="dismiss-button"]').click
|
4547
4901
|
sleep(1)
|
4902
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4548
4903
|
rescue
|
4549
4904
|
begin
|
4550
4905
|
@driver.find_element(:xpath, '//*[@id="banner"]/div[2]/div/div[1]').click
|
4551
4906
|
sleep(1)
|
4907
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4552
4908
|
rescue
|
4553
4909
|
begin
|
4554
4910
|
@driver.find_element(:xpath, '//*[@id="hd_pops_2"]/div[2]/button[1]').click
|
4555
4911
|
sleep(1)
|
4556
|
-
|
4912
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4557
4913
|
rescue
|
4558
|
-
|
4914
|
+
|
4559
4915
|
|
4560
4916
|
end
|
4561
4917
|
|
@@ -4585,63 +4941,76 @@ login_url = option['login_url'].to_s
|
|
4585
4941
|
end
|
4586
4942
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
4587
4943
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
4588
|
-
puts '-[√] 팝업 여부 확인 체크 03.......'.yellow
|
4589
4944
|
|
4590
4945
|
begin
|
4591
4946
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4592
4947
|
sleep(1)
|
4948
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4593
4949
|
rescue
|
4594
4950
|
begin
|
4595
4951
|
@driver.find_element(:xpath, '//*[@class="permanentClose"]').click
|
4596
4952
|
sleep(1)
|
4953
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4597
4954
|
rescue
|
4598
4955
|
begin
|
4599
4956
|
@driver.find_element(:xpath, '//*[@class="close"]').click
|
4600
4957
|
sleep(1)
|
4958
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4601
4959
|
rescue
|
4602
4960
|
begin
|
4603
4961
|
@driver.find_element(:partial_link_text, '닫기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4604
4962
|
sleep(1)
|
4963
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4605
4964
|
rescue
|
4606
4965
|
begin
|
4607
4966
|
@driver.find_element(:xpath, '//*[@class="fas fa-angle-down"]').click
|
4608
4967
|
sleep(1)
|
4968
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4609
4969
|
rescue
|
4610
4970
|
begin
|
4611
4971
|
@driver.find_element(:xpath, '//*[@class="fa fa-check-square-o"]').click
|
4612
4972
|
sleep(1)
|
4973
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4613
4974
|
rescue
|
4614
4975
|
begin
|
4615
4976
|
@driver.find_element(:xpath, '//*[@title="Close"]').click
|
4616
4977
|
sleep(1)
|
4978
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4617
4979
|
rescue
|
4618
4980
|
begin
|
4619
4981
|
@driver.find_element(:xpath, '//*[@alt="Close"]').click
|
4620
4982
|
sleep(1)
|
4983
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4621
4984
|
rescue
|
4622
4985
|
begin
|
4623
4986
|
@driver.find_element(:xpath, '//*[@class="sgpb-popup-close-button-1"]').click
|
4624
4987
|
sleep(1)
|
4988
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4625
4989
|
rescue
|
4626
4990
|
begin
|
4627
4991
|
@driver.find_element(:partial_link_text, '시간 동안 다시 열람하지 않습니다.').click
|
4628
4992
|
sleep(1)
|
4993
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4629
4994
|
rescue
|
4630
4995
|
begin
|
4631
4996
|
@driver.find_element(:xpath, '//*[@class="btn skip"]').click
|
4632
4997
|
sleep(1)
|
4998
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4633
4999
|
rescue
|
4634
5000
|
begin
|
4635
5001
|
@driver.find_element(:xpath, '//*[@stroke="#FAFAFA"]').click
|
4636
5002
|
sleep(1)
|
5003
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4637
5004
|
rescue
|
4638
5005
|
begin
|
4639
5006
|
@driver.find_element(:xpath, '//*[@fill="#FAFAFA"]').click
|
4640
5007
|
sleep(1)
|
5008
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4641
5009
|
rescue
|
4642
5010
|
begin
|
4643
5011
|
@driver.find_element(:xpath, '//*[@stroke-linecap="square"]').click
|
4644
5012
|
sleep(1)
|
5013
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4645
5014
|
rescue
|
4646
5015
|
begin
|
4647
5016
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="Advertisement"]'))
|
@@ -4650,24 +5019,29 @@ login_url = option['login_url'].to_s
|
|
4650
5019
|
sleep(1)
|
4651
5020
|
@driver.switch_to.default_content()
|
4652
5021
|
sleep(1)
|
5022
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4653
5023
|
rescue
|
4654
5024
|
begin
|
4655
5025
|
@driver.find_element(:xpath, '//*[@id="footer-btn-icon"]').click
|
4656
5026
|
sleep(1)
|
5027
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4657
5028
|
rescue
|
4658
5029
|
begin
|
4659
5030
|
@driver.find_element(:xpath, '//*[@id="dismiss-button"]').click
|
4660
5031
|
sleep(1)
|
5032
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4661
5033
|
rescue
|
4662
5034
|
begin
|
4663
5035
|
@driver.find_element(:xpath, '//*[@id="banner"]/div[3]/div/div[1]').click
|
4664
5036
|
sleep(1)
|
5037
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4665
5038
|
rescue
|
4666
5039
|
begin
|
4667
5040
|
@driver.find_element(:xpath, '//*[@id="hd_pops_3"]/div[2]/button[1]').click
|
4668
5041
|
sleep(1)
|
5042
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4669
5043
|
rescue
|
4670
|
-
|
5044
|
+
|
4671
5045
|
|
4672
5046
|
end
|
4673
5047
|
|
@@ -4697,63 +5071,77 @@ login_url = option['login_url'].to_s
|
|
4697
5071
|
end
|
4698
5072
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
4699
5073
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
4700
|
-
|
5074
|
+
|
4701
5075
|
|
4702
5076
|
begin
|
4703
5077
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4704
5078
|
sleep(1)
|
5079
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4705
5080
|
rescue
|
4706
5081
|
begin
|
4707
5082
|
@driver.find_element(:xpath, '//*[@class="permanentClose"]').click
|
4708
5083
|
sleep(1)
|
5084
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4709
5085
|
rescue
|
4710
5086
|
begin
|
4711
5087
|
@driver.find_element(:xpath, '//*[@class="close"]').click
|
4712
5088
|
sleep(1)
|
5089
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4713
5090
|
rescue
|
4714
5091
|
begin
|
4715
5092
|
@driver.find_element(:partial_link_text, '닫기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4716
5093
|
sleep(1)
|
5094
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4717
5095
|
rescue
|
4718
5096
|
begin
|
4719
5097
|
@driver.find_element(:xpath, '//*[@class="fas fa-angle-down"]').click
|
4720
5098
|
sleep(1)
|
5099
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4721
5100
|
rescue
|
4722
5101
|
begin
|
4723
5102
|
@driver.find_element(:xpath, '//*[@class="fa fa-check-square-o"]').click
|
4724
5103
|
sleep(1)
|
5104
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4725
5105
|
rescue
|
4726
5106
|
begin
|
4727
5107
|
@driver.find_element(:xpath, '//*[@title="Close"]').click
|
4728
5108
|
sleep(1)
|
5109
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4729
5110
|
rescue
|
4730
5111
|
begin
|
4731
5112
|
@driver.find_element(:xpath, '//*[@alt="Close"]').click
|
4732
5113
|
sleep(1)
|
5114
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4733
5115
|
rescue
|
4734
5116
|
begin
|
4735
5117
|
@driver.find_element(:xpath, '//*[@class="sgpb-popup-close-button-1"]').click
|
4736
5118
|
sleep(1)
|
5119
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4737
5120
|
rescue
|
4738
5121
|
begin
|
4739
5122
|
@driver.find_element(:partial_link_text, '시간 동안 다시 열람하지 않습니다.').click
|
4740
5123
|
sleep(1)
|
5124
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4741
5125
|
rescue
|
4742
5126
|
begin
|
4743
5127
|
@driver.find_element(:xpath, '//*[@class="btn skip"]').click
|
4744
5128
|
sleep(1)
|
5129
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4745
5130
|
rescue
|
4746
5131
|
begin
|
4747
5132
|
@driver.find_element(:xpath, '//*[@stroke="#FAFAFA"]').click
|
4748
5133
|
sleep(1)
|
5134
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4749
5135
|
rescue
|
4750
5136
|
begin
|
4751
5137
|
@driver.find_element(:xpath, '//*[@fill="#FAFAFA"]').click
|
4752
5138
|
sleep(1)
|
5139
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4753
5140
|
rescue
|
4754
5141
|
begin
|
4755
5142
|
@driver.find_element(:xpath, '//*[@stroke-linecap="square"]').click
|
4756
5143
|
sleep(1)
|
5144
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4757
5145
|
rescue
|
4758
5146
|
begin
|
4759
5147
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="Advertisement"]'))
|
@@ -4762,24 +5150,29 @@ login_url = option['login_url'].to_s
|
|
4762
5150
|
sleep(1)
|
4763
5151
|
@driver.switch_to.default_content()
|
4764
5152
|
sleep(1)
|
5153
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4765
5154
|
rescue
|
4766
5155
|
begin
|
4767
5156
|
@driver.find_element(:xpath, '//*[@id="footer-btn-icon"]').click
|
4768
5157
|
sleep(1)
|
5158
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4769
5159
|
rescue
|
4770
5160
|
begin
|
4771
5161
|
@driver.find_element(:xpath, '//*[@id="dismiss-button"]').click
|
4772
5162
|
sleep(1)
|
5163
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4773
5164
|
rescue
|
4774
5165
|
begin
|
4775
5166
|
@driver.find_element(:xpath, '//*[@id="banner"]/div[4]/div/div[1]').click
|
4776
5167
|
sleep(1)
|
5168
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4777
5169
|
rescue
|
4778
5170
|
begin
|
4779
5171
|
@driver.find_element(:xpath, '//*[@id="hd_pops_4"]/div[2]/button[1]').click
|
4780
5172
|
sleep(1)
|
5173
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4781
5174
|
rescue
|
4782
|
-
|
5175
|
+
|
4783
5176
|
|
4784
5177
|
end
|
4785
5178
|
|
@@ -4809,63 +5202,77 @@ login_url = option['login_url'].to_s
|
|
4809
5202
|
end
|
4810
5203
|
##<─────────────────────────────────────────────────────────────────────팝업 코드 확인 및 제거 부분
|
4811
5204
|
##팝업 코드 확인 및 제거 부분─────────────────────────────────────────────────────────────────────>
|
4812
|
-
|
5205
|
+
|
4813
5206
|
|
4814
5207
|
begin
|
4815
5208
|
@driver.find_element(:partial_link_text, '더 이상 보지 않기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4816
5209
|
sleep(1)
|
5210
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4817
5211
|
rescue
|
4818
5212
|
begin
|
4819
5213
|
@driver.find_element(:xpath, '//*[@class="permanentClose"]').click
|
4820
5214
|
sleep(1)
|
5215
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4821
5216
|
rescue
|
4822
5217
|
begin
|
4823
5218
|
@driver.find_element(:xpath, '//*[@class="close"]').click
|
4824
5219
|
sleep(1)
|
5220
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4825
5221
|
rescue
|
4826
5222
|
begin
|
4827
5223
|
@driver.find_element(:partial_link_text, '닫기').click #요소같고 텍스트가 다를때 텍스트로 타겟
|
4828
5224
|
sleep(1)
|
5225
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4829
5226
|
rescue
|
4830
5227
|
begin
|
4831
5228
|
@driver.find_element(:xpath, '//*[@class="fas fa-angle-down"]').click
|
4832
5229
|
sleep(1)
|
5230
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4833
5231
|
rescue
|
4834
5232
|
begin
|
4835
5233
|
@driver.find_element(:xpath, '//*[@class="fa fa-check-square-o"]').click
|
4836
5234
|
sleep(1)
|
5235
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4837
5236
|
rescue
|
4838
5237
|
begin
|
4839
5238
|
@driver.find_element(:xpath, '//*[@title="Close"]').click
|
4840
5239
|
sleep(1)
|
5240
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4841
5241
|
rescue
|
4842
5242
|
begin
|
4843
5243
|
@driver.find_element(:xpath, '//*[@alt="Close"]').click
|
4844
5244
|
sleep(1)
|
5245
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4845
5246
|
rescue
|
4846
5247
|
begin
|
4847
5248
|
@driver.find_element(:xpath, '//*[@class="sgpb-popup-close-button-1"]').click
|
4848
5249
|
sleep(1)
|
5250
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4849
5251
|
rescue
|
4850
5252
|
begin
|
4851
5253
|
@driver.find_element(:partial_link_text, '시간 동안 다시 열람하지 않습니다.').click
|
4852
5254
|
sleep(1)
|
5255
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4853
5256
|
rescue
|
4854
5257
|
begin
|
4855
5258
|
@driver.find_element(:xpath, '//*[@class="btn skip"]').click
|
4856
5259
|
sleep(1)
|
5260
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4857
5261
|
rescue
|
4858
5262
|
begin
|
4859
5263
|
@driver.find_element(:xpath, '//*[@stroke="#FAFAFA"]').click
|
4860
5264
|
sleep(1)
|
5265
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4861
5266
|
rescue
|
4862
5267
|
begin
|
4863
5268
|
@driver.find_element(:xpath, '//*[@fill="#FAFAFA"]').click
|
4864
5269
|
sleep(1)
|
5270
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4865
5271
|
rescue
|
4866
5272
|
begin
|
4867
5273
|
@driver.find_element(:xpath, '//*[@stroke-linecap="square"]').click
|
4868
5274
|
sleep(1)
|
5275
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4869
5276
|
rescue
|
4870
5277
|
begin
|
4871
5278
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@title="Advertisement"]'))
|
@@ -4874,22 +5281,27 @@ login_url = option['login_url'].to_s
|
|
4874
5281
|
sleep(1)
|
4875
5282
|
@driver.switch_to.default_content()
|
4876
5283
|
sleep(1)
|
5284
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4877
5285
|
rescue
|
4878
5286
|
begin
|
4879
5287
|
@driver.find_element(:xpath, '//*[@id="footer-btn-icon"]').click
|
4880
5288
|
sleep(1)
|
5289
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4881
5290
|
rescue
|
4882
5291
|
begin
|
4883
5292
|
@driver.find_element(:xpath, '//*[@id="dismiss-button"]').click
|
4884
5293
|
sleep(1)
|
5294
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4885
5295
|
rescue
|
4886
5296
|
begin
|
4887
5297
|
@driver.find_element(:xpath, '//*[@id="banner"]/div[5]/div/div[1]').click
|
4888
5298
|
sleep(1)
|
5299
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4889
5300
|
rescue
|
4890
5301
|
begin
|
4891
5302
|
@driver.find_element(:xpath, '//*[@id="hd_pops_5"]/div[2]/button[1]').click
|
4892
5303
|
sleep(1)
|
5304
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4893
5305
|
rescue
|
4894
5306
|
begin
|
4895
5307
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="aswift_1"]'))
|
@@ -4898,8 +5310,9 @@ login_url = option['login_url'].to_s
|
|
4898
5310
|
sleep(1)
|
4899
5311
|
@driver.switch_to.default_content
|
4900
5312
|
sleep(1)
|
5313
|
+
puts '-[√] 팝업 여부 확인 체크.......'.yellow
|
4901
5314
|
rescue
|
4902
|
-
|
5315
|
+
|
4903
5316
|
|
4904
5317
|
end
|
4905
5318
|
|
@@ -4937,7 +5350,7 @@ login_url = option['login_url'].to_s
|
|
4937
5350
|
|
4938
5351
|
|
4939
5352
|
##닉네임 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
4940
|
-
|
5353
|
+
|
4941
5354
|
|
4942
5355
|
begin
|
4943
5356
|
@driver.find_element(:xpath, '//*[@id="wr_name"]').send_keys(user_id)
|
@@ -4950,115 +5363,114 @@ begin
|
|
4950
5363
|
puts '-[√] 닉네임 2코드 타겟.......'.yellow
|
4951
5364
|
rescue
|
4952
5365
|
begin
|
4953
|
-
|
4954
|
-
|
4955
|
-
|
4956
|
-
puts '-[√] 닉네임 3-1코드 타겟.......'.yellow
|
4957
|
-
rescue
|
4958
|
-
rows = @driver.find_elements(class: 'kboard-attr-row')
|
4959
|
-
rows.each do |row|
|
4960
|
-
begin
|
4961
|
-
input_element = row.find_element(xpath: './/input[@name="member_display"]')
|
4962
|
-
input_element.send_keys(user_id)
|
4963
|
-
sleep(1)
|
4964
|
-
puts '-[√] 닉네임 3-2코드 타겟.......'.yellow
|
4965
|
-
rescue
|
4966
|
-
next
|
4967
|
-
end
|
4968
|
-
end
|
4969
|
-
end
|
5366
|
+
@driver.find_element(:xpath, '//*[@name="member_display"]').send_keys(user_id)
|
5367
|
+
sleep(1)
|
5368
|
+
puts '-[√] 닉네임 3-1코드 타겟.......'.yellow
|
4970
5369
|
rescue
|
4971
5370
|
begin
|
4972
|
-
@driver.find_element(:
|
5371
|
+
@driver.find_element(xpath: '//input[@name="member_display"]').send_keys(user_id)
|
4973
5372
|
sleep(1)
|
4974
|
-
puts '-[√] 닉네임
|
5373
|
+
puts '-[√] 닉네임 3-2코드 타겟.......'.yellow
|
4975
5374
|
rescue
|
4976
5375
|
begin
|
4977
|
-
@driver.find_element(:xpath, '//*[@
|
5376
|
+
@driver.find_element(:xpath, '//*[@title="닉네임"]').send_keys(user_id)
|
4978
5377
|
sleep(1)
|
4979
|
-
puts '-[√] 닉네임
|
5378
|
+
puts '-[√] 닉네임 4코드 타겟.......'.yellow
|
4980
5379
|
rescue
|
4981
5380
|
begin
|
4982
|
-
@driver.find_element(:xpath, '//*[@name="
|
5381
|
+
@driver.find_element(:xpath, '//*[@name="name"]').send_keys(user_id)
|
4983
5382
|
sleep(1)
|
4984
|
-
puts '-[√] 닉네임
|
5383
|
+
puts '-[√] 닉네임 5코드 타겟.......'.yellow
|
4985
5384
|
rescue
|
4986
5385
|
begin
|
4987
|
-
@driver.find_element(:xpath, '//*[@name="
|
5386
|
+
@driver.find_element(:xpath, '//*[@name="writer"]').send_keys(user_id)
|
4988
5387
|
sleep(1)
|
4989
|
-
puts '-[√] 닉네임
|
5388
|
+
puts '-[√] 닉네임 6코드 타겟.......'.yellow
|
4990
5389
|
rescue
|
4991
5390
|
begin
|
4992
|
-
@driver.find_element(:xpath, '//*[@name="
|
5391
|
+
@driver.find_element(:xpath, '//*[@name="hname"]').send_keys(user_id)
|
4993
5392
|
sleep(1)
|
4994
|
-
puts '-[√] 닉네임
|
5393
|
+
puts '-[√] 닉네임 7코드 타겟.......'.yellow
|
4995
5394
|
rescue
|
4996
5395
|
begin
|
4997
|
-
@driver.find_element(:xpath, '//*[@name="
|
5396
|
+
@driver.find_element(:xpath, '//*[@name="wr_name"]').send_keys(user_id)
|
4998
5397
|
sleep(1)
|
4999
|
-
puts '-[√] 닉네임
|
5398
|
+
puts '-[√] 닉네임 8코드 타겟.......'.yellow
|
5000
5399
|
rescue
|
5001
5400
|
begin
|
5002
|
-
@driver.find_element(:xpath, '//*[@name="
|
5401
|
+
@driver.find_element(:xpath, '//*[@name="post_nickname"]').send_keys(user_id)
|
5003
5402
|
sleep(1)
|
5004
|
-
puts '-[√] 닉네임
|
5403
|
+
puts '-[√] 닉네임 9코드 타겟.......'.yellow
|
5005
5404
|
rescue
|
5006
5405
|
begin
|
5007
|
-
@driver.find_element(:xpath, '//*[@
|
5406
|
+
@driver.find_element(:xpath, '//*[@name="user_name"]').send_keys(user_id)
|
5008
5407
|
sleep(1)
|
5009
|
-
puts '-[√] 닉네임
|
5408
|
+
puts '-[√] 닉네임 10코드 타겟.......'.yellow
|
5010
5409
|
rescue
|
5011
5410
|
begin
|
5012
|
-
@driver.find_element(:xpath, '//*[@
|
5411
|
+
@driver.find_element(:xpath, '//*[@class="mb-user-name"]').send_keys(user_id)
|
5013
5412
|
sleep(1)
|
5014
|
-
puts '-[√] 닉네임
|
5413
|
+
puts '-[√] 닉네임 11코드 타겟.......'.yellow
|
5015
5414
|
rescue
|
5016
5415
|
begin
|
5017
|
-
@driver.find_element(:xpath, '//*[@placeholder="
|
5416
|
+
@driver.find_element(:xpath, '//*[@placeholder="비회원 닉네임"]').send_keys(user_id)
|
5018
5417
|
sleep(1)
|
5019
|
-
puts '-[√] 닉네임
|
5418
|
+
puts '-[√] 닉네임 12코드 타겟.......'.yellow
|
5020
5419
|
rescue
|
5021
5420
|
begin
|
5022
|
-
@driver.find_element(:xpath, '//*[@
|
5421
|
+
@driver.find_element(:xpath, '//*[@placeholder="이름"]').send_keys(user_id)
|
5023
5422
|
sleep(1)
|
5024
|
-
puts '-[√] 닉네임
|
5423
|
+
puts '-[√] 닉네임 13코드 타겟.......'.yellow
|
5025
5424
|
rescue
|
5026
5425
|
begin
|
5027
|
-
@driver.find_element(:xpath, '//*[@name="
|
5426
|
+
@driver.find_element(:xpath, '//*[@name="nickname"]').send_keys(user_id)
|
5028
5427
|
sleep(1)
|
5029
|
-
puts '-[√] 닉네임
|
5428
|
+
puts '-[√] 닉네임 14코드 타겟.......'.yellow
|
5030
5429
|
rescue
|
5031
5430
|
begin
|
5032
|
-
@driver.find_element(:xpath, '//*[@
|
5431
|
+
@driver.find_element(:xpath, '//*[@name="nick"]').send_keys(user_id)
|
5033
5432
|
sleep(1)
|
5034
|
-
puts '-[√] 닉네임
|
5433
|
+
puts '-[√] 닉네임 15코드 타겟.......'.yellow
|
5035
5434
|
rescue
|
5036
5435
|
begin
|
5037
|
-
@driver.find_element(:xpath, '//*[@
|
5436
|
+
@driver.find_element(:xpath, '//*[@placeholder="작성자 이름"]').send_keys(user_id)
|
5038
5437
|
sleep(1)
|
5039
|
-
puts '-[√] 닉네임
|
5438
|
+
puts '-[√] 닉네임 16코드 타겟.......'.yellow
|
5040
5439
|
rescue
|
5041
5440
|
begin
|
5042
|
-
@driver.find_element(:xpath, '//*[@id="
|
5441
|
+
@driver.find_element(:xpath, '//*[@id="reg_name"]').send_keys(user_id)
|
5043
5442
|
sleep(1)
|
5044
|
-
puts '-[√] 닉네임
|
5443
|
+
puts '-[√] 닉네임 17코드 타겟.......'.yellow
|
5045
5444
|
rescue
|
5046
5445
|
begin
|
5047
|
-
@driver.find_element(:xpath, '//*[@id="
|
5446
|
+
@driver.find_element(:xpath, '//*[@id="postWriter"]').send_keys(user_id)
|
5048
5447
|
sleep(1)
|
5049
|
-
puts '-[√] 닉네임
|
5448
|
+
puts '-[√] 닉네임 18코드 타겟.......'.yellow
|
5050
5449
|
rescue
|
5051
5450
|
begin
|
5052
|
-
@driver.find_element(:xpath, '//*[@
|
5451
|
+
@driver.find_element(:xpath, '//*[@id="kboard-input-member-display"]').send_keys(user_id)
|
5053
5452
|
sleep(1)
|
5054
|
-
puts '-[√] 닉네임
|
5453
|
+
puts '-[√] 닉네임 19코드 타겟.......'.yellow
|
5055
5454
|
rescue
|
5056
5455
|
begin
|
5057
|
-
@driver.find_element(:xpath, '//*[@name="
|
5456
|
+
@driver.find_element(:xpath, '//*[@name="nick_name"]').send_keys(user_id)
|
5058
5457
|
sleep(1)
|
5059
|
-
puts '-[√] 닉네임
|
5458
|
+
puts '-[√] 닉네임 20코드 타겟.......'.yellow
|
5060
5459
|
rescue
|
5061
|
-
|
5460
|
+
begin
|
5461
|
+
@driver.find_element(:xpath, '//*[@name="write_name"]').send_keys(user_id)
|
5462
|
+
sleep(1)
|
5463
|
+
puts '-[√] 닉네임 21코드 타겟.......'.yellow
|
5464
|
+
rescue
|
5465
|
+
begin
|
5466
|
+
@driver.find_element(:xpath, '//*[@placeholder="작성자"]').send_keys(user_id)
|
5467
|
+
sleep(1)
|
5468
|
+
puts '-[√] 닉네임 22코드 타겟.......'.yellow
|
5469
|
+
rescue
|
5470
|
+
|
5471
|
+
end
|
5472
|
+
|
5473
|
+
end
|
5062
5474
|
end
|
5063
5475
|
end
|
5064
5476
|
end
|
@@ -5079,13 +5491,13 @@ begin
|
|
5079
5491
|
end
|
5080
5492
|
end
|
5081
5493
|
end
|
5082
|
-
|
5494
|
+
|
5083
5495
|
end
|
5084
5496
|
##<─────────────────────────────────────────────────────────────────────닉네임 입력 코드 부분
|
5085
5497
|
|
5086
5498
|
|
5087
5499
|
##패스워드 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
5088
|
-
|
5500
|
+
|
5089
5501
|
begin
|
5090
5502
|
@driver.find_element(:xpath, '//*[@id="wr_password"]').send_keys(user_pw)
|
5091
5503
|
sleep(1)
|
@@ -5176,7 +5588,7 @@ begin
|
|
5176
5588
|
end
|
5177
5589
|
end
|
5178
5590
|
end
|
5179
|
-
|
5591
|
+
|
5180
5592
|
sleep(1)
|
5181
5593
|
end
|
5182
5594
|
##<─────────────────────────────────────────────────────────────────────패스워드 입력 코드 부분
|
@@ -5221,7 +5633,7 @@ begin
|
|
5221
5633
|
@driver.find_element(:xpath, '//*[@name="wr_10"]').send_keys(more_txt1)
|
5222
5634
|
sleep(1)
|
5223
5635
|
rescue
|
5224
|
-
|
5636
|
+
|
5225
5637
|
|
5226
5638
|
end
|
5227
5639
|
|
@@ -5257,7 +5669,7 @@ begin
|
|
5257
5669
|
@driver.find_element(:xpath, '//*[@name="wr_11"]').send_keys(more_txt1)
|
5258
5670
|
sleep(1)
|
5259
5671
|
rescue
|
5260
|
-
|
5672
|
+
|
5261
5673
|
|
5262
5674
|
end
|
5263
5675
|
|
@@ -5293,7 +5705,7 @@ begin
|
|
5293
5705
|
@driver.find_element(:xpath, '//*[@name="wr_12"]').send_keys(more_txt1)
|
5294
5706
|
sleep(1)
|
5295
5707
|
rescue
|
5296
|
-
|
5708
|
+
|
5297
5709
|
|
5298
5710
|
end
|
5299
5711
|
|
@@ -5329,7 +5741,7 @@ begin
|
|
5329
5741
|
@driver.find_element(:xpath, '//*[@name="wr_13"]').send_keys(more_txt1)
|
5330
5742
|
sleep(1)
|
5331
5743
|
rescue
|
5332
|
-
|
5744
|
+
|
5333
5745
|
|
5334
5746
|
end
|
5335
5747
|
|
@@ -5365,7 +5777,7 @@ begin
|
|
5365
5777
|
@driver.find_element(:xpath, '//*[@name="wr_14"]').send_keys(more_txt1)
|
5366
5778
|
sleep(1)
|
5367
5779
|
rescue
|
5368
|
-
|
5780
|
+
|
5369
5781
|
|
5370
5782
|
end
|
5371
5783
|
|
@@ -5480,7 +5892,7 @@ begin
|
|
5480
5892
|
|
5481
5893
|
|
5482
5894
|
##체크박스 코드 부분─────────────────────────────────────────────────────────────────────>
|
5483
|
-
puts '-[√] 체크 항목 탐색 시작.......'.yellow
|
5895
|
+
#puts '-[√] 체크 항목 탐색 시작.......'.yellow
|
5484
5896
|
begin
|
5485
5897
|
@driver.find_element(:xpath, '//*[@fw-label="개인정보보호정책"]').click
|
5486
5898
|
sleep(1)
|
@@ -5558,12 +5970,12 @@ begin
|
|
5558
5970
|
|
5559
5971
|
title = title.strip
|
5560
5972
|
##제목 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
5561
|
-
puts '-[√] 제목 입력 필드 탐색 시작.......'.yellow
|
5973
|
+
#puts '-[√] 제목 입력 필드 탐색 시작.......'.yellow
|
5562
5974
|
|
5563
5975
|
begin
|
5564
5976
|
@driver.find_element(:xpath, '//*[@id="wr_subject"]').click
|
5565
5977
|
sleep(1)
|
5566
|
-
@driver.find_element(:xpath, '//*[@id="wr_subject"]').send_keys(
|
5978
|
+
@driver.find_element(:xpath, '//*[@id="wr_subject"]').send_keys(title)
|
5567
5979
|
puts '-[√] 제목 code 1.......'.yellow
|
5568
5980
|
rescue
|
5569
5981
|
begin
|
@@ -5666,7 +6078,7 @@ begin
|
|
5666
6078
|
########################################################2차@#######################################
|
5667
6079
|
begin
|
5668
6080
|
|
5669
|
-
@driver.find_element(:xpath, '//*[@id="wr_subject"]').send_keys(
|
6081
|
+
@driver.find_element(:xpath, '//*[@id="wr_subject"]').send_keys(title)
|
5670
6082
|
puts '-[√] 제목 code 19.......'.yellow
|
5671
6083
|
rescue
|
5672
6084
|
begin
|
@@ -5827,14 +6239,14 @@ begin
|
|
5827
6239
|
end
|
5828
6240
|
end
|
5829
6241
|
|
5830
|
-
puts '-[√] 제목 입력 필드 탐색 종료.......'.yellow
|
6242
|
+
#puts '-[√] 제목 입력 필드 탐색 종료.......'.yellow
|
5831
6243
|
sleep(1)
|
5832
6244
|
##<─────────────────────────────────────────────────────────────────────제목 입력 코드 부분
|
5833
6245
|
|
5834
6246
|
|
5835
6247
|
##HTML 버튼 코드 부분─────────────────────────────────────────────────────────────────────>
|
5836
|
-
|
5837
|
-
|
6248
|
+
# puts '-[√] HTML 코드 변경 버튼 탐색 시작.......'.yellow
|
6249
|
+
|
5838
6250
|
begin
|
5839
6251
|
#아이프레임에서 코드 선택
|
5840
6252
|
@driver.switch_to.frame(@driver.find_element(:xpath, '//*[@scrolling="no"]'))
|
@@ -6094,13 +6506,12 @@ begin
|
|
6094
6506
|
end
|
6095
6507
|
end
|
6096
6508
|
|
6097
|
-
|
6098
|
-
sleep(1)
|
6099
|
-
|
6509
|
+
|
6100
6510
|
|
6101
6511
|
begin
|
6102
6512
|
sleep(2)
|
6103
6513
|
@driver.switch_to.alert.accept
|
6514
|
+
sleep(1)
|
6104
6515
|
rescue
|
6105
6516
|
sleep(1)
|
6106
6517
|
end
|
@@ -6112,8 +6523,8 @@ begin
|
|
6112
6523
|
|
6113
6524
|
|
6114
6525
|
##내용 입력 필드 코드 부분─────────────────────────────────────────────────────────────────────>
|
6115
|
-
puts '-[√] 내용 입력 부분 탐색 시작.......'.yellow
|
6116
|
-
sleep(1)
|
6526
|
+
#puts '-[√] 내용 입력 부분 탐색 시작.......'.yellow
|
6527
|
+
#sleep(1)
|
6117
6528
|
begin
|
6118
6529
|
@driver.find_element(:xpath, '//*[@name="content"]').click
|
6119
6530
|
sleep(1)
|
@@ -6337,20 +6748,7 @@ rescue
|
|
6337
6748
|
sleep(1)
|
6338
6749
|
puts '내용 항목 코드 타겟 39.......'.red
|
6339
6750
|
rescue
|
6340
|
-
|
6341
|
-
dev_tools = driver.execute_cdp_cmd('Emulate.DeviceMetrics', {
|
6342
|
-
'width' => 375, # 모바일 화면 너비 (예: iPhone X 너비)
|
6343
|
-
'height' => 667, # 모바일 화면 높이
|
6344
|
-
'deviceScaleFactor' => 3.0, # 화면 비율
|
6345
|
-
'mobile' => true # 모바일 모드 활성화
|
6346
|
-
})
|
6347
|
-
sleep(1)
|
6348
|
-
@driver.find_element(:xpath, '//textarea[@name="kboard_content"]').click
|
6349
|
-
sleep(1)
|
6350
|
-
puts '내용 항목 코드 타겟 40.......'.red
|
6351
|
-
rescue
|
6352
|
-
|
6353
|
-
end
|
6751
|
+
|
6354
6752
|
end
|
6355
6753
|
end
|
6356
6754
|
end
|
@@ -6392,9 +6790,9 @@ rescue
|
|
6392
6790
|
end
|
6393
6791
|
end
|
6394
6792
|
|
6395
|
-
|
6396
|
-
|
6397
|
-
|
6793
|
+
|
6794
|
+
end
|
6795
|
+
sleep(1)
|
6398
6796
|
|
6399
6797
|
##<─────────────────────────────────────────────────────────────────────내용 입력 필드 코드 부분
|
6400
6798
|
|
@@ -6407,7 +6805,7 @@ rescue
|
|
6407
6805
|
end
|
6408
6806
|
##<<─────────────────────────────────────────────────────────────────────내용 임시부분 제거
|
6409
6807
|
|
6410
|
-
|
6808
|
+
|
6411
6809
|
puts content
|
6412
6810
|
noko = Nokogiri::HTML(content, nil, Encoding::UTF_8.to_s)
|
6413
6811
|
toomung = 0
|
@@ -6415,7 +6813,7 @@ end
|
|
6415
6813
|
|
6416
6814
|
sleep(1)
|
6417
6815
|
data = Hash.new
|
6418
|
-
|
6816
|
+
|
6419
6817
|
|
6420
6818
|
|
6421
6819
|
|
@@ -7389,42 +7787,106 @@ end
|
|
7389
7787
|
|
7390
7788
|
|
7391
7789
|
|
7392
|
-
|
7790
|
+
begin
|
7791
|
+
|
7792
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]')
|
7793
|
+
check_captcha = 1
|
7393
7794
|
|
7795
|
+
rescue
|
7796
|
+
check_captcha = 0
|
7797
|
+
end
|
7394
7798
|
|
7395
|
-
|
7396
|
-
|
7397
|
-
|
7799
|
+
if check_captcha == 1
|
7800
|
+
begin
|
7801
|
+
# 타임아웃을 3초로 설정
|
7802
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
7803
|
+
# 요소가 나타날 때까지 30초 동안 기다립니다.
|
7804
|
+
wait.until { @driver.find_element(:xpath, '//*[@data-state="ready"]') }
|
7805
|
+
sleep(1)
|
7398
7806
|
|
7807
|
+
el_ready = @driver.find_element(:xpath, '//*[@data-state="ready"]')
|
7808
|
+
@driver.action.move_to(el_ready).perform
|
7809
|
+
sleep(1)
|
7399
7810
|
|
7400
|
-
|
7401
|
-
|
7402
|
-
|
7403
|
-
|
7404
|
-
|
7405
|
-
|
7406
|
-
|
7407
|
-
|
7408
|
-
|
7409
|
-
|
7410
|
-
|
7411
|
-
|
7412
|
-
|
7413
|
-
|
7414
|
-
|
7415
|
-
|
7416
|
-
|
7417
|
-
|
7418
|
-
|
7419
|
-
|
7420
|
-
|
7811
|
+
puts '-[√] 캡챠 해제 진행 중 (약 30~60 초 소요됩니다).......'.green
|
7812
|
+
begin
|
7813
|
+
@driver.find_element(:xpath, '//*[@data-state="ready"]').click #캡챠우회버튼
|
7814
|
+
rescue
|
7815
|
+
begin
|
7816
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-image"]').click #캡챠우회버튼
|
7817
|
+
rescue
|
7818
|
+
begin
|
7819
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver-info"]').click #캡챠우회버튼
|
7820
|
+
rescue
|
7821
|
+
begin
|
7822
|
+
@driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]').click #캡챠우회버튼
|
7823
|
+
rescue
|
7824
|
+
end
|
7825
|
+
end
|
7826
|
+
end
|
7827
|
+
end
|
7828
|
+
|
7829
|
+
|
7830
|
+
sleep(10)
|
7831
|
+
begin
|
7832
|
+
@driver.find_element(:xpath, '//*[@data-state="error"]').click
|
7833
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
7834
|
+
puts '-[√] 캡챠 해제 실패 !! API번호 및 포인트를 체크해주세요.......'.red
|
7835
|
+
@driver.window_handles.each do |handle|
|
7836
|
+
@driver.switch_to.window(handle)
|
7837
|
+
begin
|
7838
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
7839
|
+
@driver.close
|
7840
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
7841
|
+
puts '-[√] 다음 작업 준비로 약 1초~60초 내외 시간이 소요됩니다.......'.red
|
7842
|
+
end
|
7843
|
+
end
|
7844
|
+
return 0
|
7845
|
+
@driver.quit
|
7846
|
+
rescue
|
7847
|
+
# 타임아웃을 77초로 설정
|
7848
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 150)
|
7849
|
+
# 요소가 나타날 때까지 100초 동안 기다립니다.
|
7850
|
+
wait.until { @driver.find_element(:xpath, '//*[@data-state="solved"]') }
|
7851
|
+
sleep(1)
|
7852
|
+
@driver.find_element(:xpath, '//*[@data-state="solved"]').click
|
7853
|
+
puts '-[√] 캡챠 해제 완료 → 이어서 진행 합니다.......'.green
|
7854
|
+
sleep(3)
|
7855
|
+
begin
|
7856
|
+
@driver.find_element(:xpath, '//*[@name="user_captcha"]').click
|
7857
|
+
sleep(1)
|
7858
|
+
@driver.action.key_down(:right).key_up(:right).perform
|
7859
|
+
rescue
|
7860
|
+
begin
|
7861
|
+
@driver.find_element(:xpath, '//*[@id="user_captcha"]').click
|
7862
|
+
sleep(1)
|
7863
|
+
@driver.action.key_down(:right).key_up(:right).perform
|
7864
|
+
rescue
|
7865
|
+
begin
|
7866
|
+
@driver.find_element(:xpath, '//*[@title="자동글쓰기방지"]').click
|
7867
|
+
sleep(1)
|
7868
|
+
@driver.action.key_down(:right).key_up(:right).perform
|
7869
|
+
rescue
|
7870
|
+
end
|
7871
|
+
end
|
7872
|
+
end
|
7873
|
+
sleep(1)
|
7874
|
+
end
|
7875
|
+
rescue
|
7876
|
+
|
7877
|
+
end
|
7878
|
+
else
|
7879
|
+
end
|
7880
|
+
|
7881
|
+
if check_captcha == 0
|
7882
|
+
puts'캡챠 유무 확인.......'.yellow
|
7421
7883
|
begin
|
7422
7884
|
@driver.switch_to.default_content()
|
7423
|
-
#@driver.find_element(:xpath, '//*[@
|
7424
|
-
el = @driver.find_element(:xpath, '//*[@
|
7885
|
+
#@driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
7886
|
+
el = @driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
7425
7887
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7426
7888
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7427
|
-
puts '-[√] 챕챠 코드 code
|
7889
|
+
puts '-[√] 챕챠 코드 code 1.......'.red
|
7428
7890
|
sleep(1)
|
7429
7891
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7430
7892
|
sleep(1)
|
@@ -7441,18 +7903,11 @@ rescue
|
|
7441
7903
|
rescue
|
7442
7904
|
begin
|
7443
7905
|
@driver.switch_to.default_content()
|
7444
|
-
|
7445
|
-
|
7446
|
-
el = @driver.find_element(:xpath, '//*[@id="captcha_img"]')
|
7906
|
+
#@driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
7907
|
+
el = @driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
7447
7908
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7448
7909
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7449
|
-
puts '-[√] 챕챠 코드 code
|
7450
|
-
sleep(1)
|
7451
|
-
#요소 자체 제거 하기 기능
|
7452
|
-
chat_box = @driver.find_element(:xpath, '//*[@for="captcha_key"]')
|
7453
|
-
@driver.execute_script("arguments[0].remove();", chat_box)
|
7454
|
-
sleep(1)
|
7455
|
-
|
7910
|
+
puts '-[√] 챕챠 코드 code 2.......'.red
|
7456
7911
|
sleep(1)
|
7457
7912
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7458
7913
|
sleep(1)
|
@@ -7469,11 +7924,17 @@ rescue
|
|
7469
7924
|
rescue
|
7470
7925
|
begin
|
7471
7926
|
@driver.switch_to.default_content()
|
7472
|
-
#@driver.find_element(:xpath, '//*[@id="
|
7473
|
-
el = @driver.find_element(:xpath, '//*[@id="
|
7927
|
+
#@driver.find_element(:xpath, '//*[@id="captcha_img"]').send_keys(:tab)
|
7928
|
+
el = @driver.find_element(:xpath, '//*[@id="captcha_img"]')
|
7474
7929
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7475
7930
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7476
|
-
puts '-[√] 챕챠 코드 code
|
7931
|
+
puts '-[√] 챕챠 코드 code 3.......'.red
|
7932
|
+
sleep(1)
|
7933
|
+
#요소 자체 제거 하기 기능
|
7934
|
+
chat_box = @driver.find_element(:xpath, '//*[@for="captcha_key"]')
|
7935
|
+
@driver.execute_script("arguments[0].remove();", chat_box)
|
7936
|
+
sleep(1)
|
7937
|
+
|
7477
7938
|
sleep(1)
|
7478
7939
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7479
7940
|
sleep(1)
|
@@ -7490,15 +7951,11 @@ rescue
|
|
7490
7951
|
rescue
|
7491
7952
|
begin
|
7492
7953
|
@driver.switch_to.default_content()
|
7493
|
-
|
7494
|
-
|
7495
|
-
el = img # 캡챠 이미지를 el에 저장
|
7496
|
-
break # 첫 번째 이미지를 찾으면 루프 종료
|
7497
|
-
end
|
7498
|
-
end
|
7954
|
+
#@driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
7955
|
+
el = @driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
7499
7956
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7500
7957
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7501
|
-
puts '-[√] 챕챠 코드 code
|
7958
|
+
puts '-[√] 챕챠 코드 code 4.......'.red
|
7502
7959
|
sleep(1)
|
7503
7960
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7504
7961
|
sleep(1)
|
@@ -7515,11 +7972,10 @@ rescue
|
|
7515
7972
|
rescue
|
7516
7973
|
begin
|
7517
7974
|
@driver.switch_to.default_content()
|
7518
|
-
|
7519
|
-
el = @driver.find_element(:css, 'label[for="kboard-input-captcha"] img')
|
7975
|
+
el = @driver.find_element(:xpath, '//img[contains(@src, "kboard_captcha")]')
|
7520
7976
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7521
7977
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7522
|
-
puts '-[√] 챕챠 코드 code 5-
|
7978
|
+
puts '-[√] 챕챠 코드 code 5-1.......'.red
|
7523
7979
|
sleep(1)
|
7524
7980
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7525
7981
|
sleep(1)
|
@@ -7536,12 +7992,11 @@ rescue
|
|
7536
7992
|
rescue
|
7537
7993
|
begin
|
7538
7994
|
@driver.switch_to.default_content()
|
7539
|
-
|
7540
|
-
|
7541
|
-
el = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
7995
|
+
#@driver.find_element(:xpath, '//*[@for="kboard-input-captcha"]')
|
7996
|
+
el = @driver.find_element(:xpath, '//*[@for="kboard-input-captcha"] img')
|
7542
7997
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7543
7998
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7544
|
-
puts '-[√] 챕챠 코드 code
|
7999
|
+
puts '-[√] 챕챠 코드 code 5-2.......'.red
|
7545
8000
|
sleep(1)
|
7546
8001
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7547
8002
|
sleep(1)
|
@@ -7558,11 +8013,12 @@ rescue
|
|
7558
8013
|
rescue
|
7559
8014
|
begin
|
7560
8015
|
@driver.switch_to.default_content()
|
7561
|
-
|
7562
|
-
|
8016
|
+
sleep(1)
|
8017
|
+
#@driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
8018
|
+
el = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
7563
8019
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7564
8020
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7565
|
-
puts '-[√] 챕챠 코드 code
|
8021
|
+
puts '-[√] 챕챠 코드 code 6.......'.red
|
7566
8022
|
sleep(1)
|
7567
8023
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7568
8024
|
sleep(1)
|
@@ -7579,11 +8035,11 @@ rescue
|
|
7579
8035
|
rescue
|
7580
8036
|
begin
|
7581
8037
|
@driver.switch_to.default_content()
|
7582
|
-
#@driver.find_element(:xpath, '//*[@
|
7583
|
-
el = @driver.find_element(:xpath, '//*[@
|
8038
|
+
#@driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
8039
|
+
el = @driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
7584
8040
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7585
8041
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7586
|
-
puts '-[√] 챕챠 코드 code
|
8042
|
+
puts '-[√] 챕챠 코드 code 7.......'.red
|
7587
8043
|
sleep(1)
|
7588
8044
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7589
8045
|
sleep(1)
|
@@ -7600,11 +8056,11 @@ rescue
|
|
7600
8056
|
rescue
|
7601
8057
|
begin
|
7602
8058
|
@driver.switch_to.default_content()
|
7603
|
-
#@driver.find_element(:xpath, '//*[@id="
|
7604
|
-
el = @driver.find_element(:xpath, '//*[@id="
|
8059
|
+
#@driver.find_element(:xpath, '//*[@id="spamauth"]')
|
8060
|
+
el = @driver.find_element(:xpath, '//*[@id="spamauth"]')
|
7605
8061
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7606
8062
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7607
|
-
puts '-[√] 챕챠 코드 code
|
8063
|
+
puts '-[√] 챕챠 코드 code 8.......'.red
|
7608
8064
|
sleep(1)
|
7609
8065
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7610
8066
|
sleep(1)
|
@@ -7621,10 +8077,11 @@ rescue
|
|
7621
8077
|
rescue
|
7622
8078
|
begin
|
7623
8079
|
@driver.switch_to.default_content()
|
7624
|
-
|
8080
|
+
#@driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
8081
|
+
el = @driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
7625
8082
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7626
8083
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7627
|
-
puts '-[√] 챕챠 코드 code
|
8084
|
+
puts '-[√] 챕챠 코드 code 9.......'.red
|
7628
8085
|
sleep(1)
|
7629
8086
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7630
8087
|
sleep(1)
|
@@ -7641,10 +8098,10 @@ rescue
|
|
7641
8098
|
rescue
|
7642
8099
|
begin
|
7643
8100
|
@driver.switch_to.default_content()
|
7644
|
-
el = @driver.find_element(:xpath, '//*[@
|
8101
|
+
el = @driver.find_element(:xpath, '//*[@class="CodeImage"]')
|
7645
8102
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7646
8103
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7647
|
-
puts '-[√] 챕챠 코드 code
|
8104
|
+
puts '-[√] 챕챠 코드 code 10.......'.red
|
7648
8105
|
sleep(1)
|
7649
8106
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7650
8107
|
sleep(1)
|
@@ -7661,10 +8118,10 @@ rescue
|
|
7661
8118
|
rescue
|
7662
8119
|
begin
|
7663
8120
|
@driver.switch_to.default_content()
|
7664
|
-
el = @driver.find_element(:xpath, '//*[@
|
8121
|
+
el = @driver.find_element(:xpath, '//*[@id="kcaptcha_image"]')
|
7665
8122
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7666
8123
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7667
|
-
puts '-[√] 챕챠 코드 code
|
8124
|
+
puts '-[√] 챕챠 코드 code 11.......'.red
|
7668
8125
|
sleep(1)
|
7669
8126
|
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7670
8127
|
sleep(1)
|
@@ -7679,72 +8136,51 @@ rescue
|
|
7679
8136
|
sleep(1)
|
7680
8137
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7681
8138
|
rescue
|
7682
|
-
|
7683
|
-
|
7684
|
-
|
7685
|
-
|
7686
|
-
|
7687
|
-
|
7688
|
-
|
7689
|
-
|
7690
|
-
|
7691
|
-
|
7692
|
-
|
7693
|
-
|
7694
|
-
|
7695
|
-
|
7696
|
-
|
7697
|
-
|
7698
|
-
|
7699
|
-
|
7700
|
-
|
7701
|
-
|
7702
|
-
|
7703
|
-
|
7704
|
-
|
7705
|
-
|
7706
|
-
|
7707
|
-
|
7708
|
-
|
7709
|
-
|
7710
|
-
|
7711
|
-
|
7712
|
-
|
7713
|
-
|
7714
|
-
|
7715
|
-
|
7716
|
-
@driver.action.key_stroke('enter')
|
7717
|
-
sleep(1)
|
8139
|
+
begin
|
8140
|
+
@driver.switch_to.default_content()
|
8141
|
+
el = @driver.find_element(:xpath, '//*[@class="lazy-loaded"]')
|
8142
|
+
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
8143
|
+
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
8144
|
+
puts '-[√] 챕챠 코드 code 12.......'.red
|
8145
|
+
sleep(1)
|
8146
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
8147
|
+
sleep(1)
|
8148
|
+
mouse_move_percentage(0.3,0.02)
|
8149
|
+
sleep(0.5)
|
8150
|
+
left_click
|
8151
|
+
sleep(1)
|
8152
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
8153
|
+
@driver.action.context_click(el).perform #우 클릭
|
8154
|
+
sleep(1)
|
8155
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
8156
|
+
sleep(1)
|
8157
|
+
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
8158
|
+
rescue
|
8159
|
+
|
8160
|
+
end
|
8161
|
+
end
|
8162
|
+
end
|
8163
|
+
end
|
8164
|
+
end
|
8165
|
+
end
|
8166
|
+
end
|
8167
|
+
end
|
8168
|
+
end
|
8169
|
+
end
|
8170
|
+
end
|
8171
|
+
end
|
8172
|
+
end
|
7718
8173
|
|
7719
|
-
begin
|
7720
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
7721
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
7722
|
-
#요소가 나타날 때까지 7초 동안 기다립니다.
|
7723
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
7724
|
-
rescue
|
7725
|
-
sleep(1)
|
7726
|
-
@driver.action.key_stroke('left')
|
7727
|
-
sleep(1)
|
7728
|
-
@driver.action.key_stroke('up')
|
7729
|
-
sleep(1)
|
7730
|
-
@driver.action.key_stroke('enter')
|
7731
|
-
sleep(1)
|
7732
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
7733
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
7734
|
-
#요소가 나타날 때까지 7초 동안 기다립니다.
|
7735
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
7736
|
-
end
|
7737
|
-
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
7738
8174
|
sleep(1)
|
7739
|
-
|
8175
|
+
|
8176
|
+
puts '-[√] 캡챠 입력 항목 탐색.......'.green
|
7740
8177
|
begin
|
7741
|
-
@driver.find_element(:xpath, '//*[@
|
7742
|
-
|
7743
|
-
sleep(1)
|
8178
|
+
@driver.find_element(:xpath, '//*[@name="captcha_key"]').click
|
7744
8179
|
|
7745
|
-
|
8180
|
+
sleep(1)
|
8181
|
+
|
8182
|
+
el2 = @driver.find_element(:xpath, '//*[@name="captcha_key"]')
|
7746
8183
|
@driver.action.context_click(el2).perform
|
7747
|
-
|
7748
8184
|
sleep(1)
|
7749
8185
|
@driver.action.key_stroke('up')
|
7750
8186
|
sleep(1)
|
@@ -7752,33 +8188,34 @@ rescue
|
|
7752
8188
|
sleep(1)
|
7753
8189
|
@driver.action.key_stroke('enter')
|
7754
8190
|
sleep(1)
|
8191
|
+
|
7755
8192
|
begin
|
7756
|
-
|
7757
|
-
|
7758
|
-
|
7759
|
-
|
7760
|
-
|
7761
|
-
|
7762
|
-
|
7763
|
-
|
7764
|
-
|
7765
|
-
|
7766
|
-
|
7767
|
-
|
7768
|
-
|
7769
|
-
|
7770
|
-
|
7771
|
-
|
7772
|
-
|
8193
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8194
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8195
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8196
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8197
|
+
rescue
|
8198
|
+
sleep(1)
|
8199
|
+
@driver.action.key_stroke('left')
|
8200
|
+
sleep(1)
|
8201
|
+
@driver.action.key_stroke('up')
|
8202
|
+
sleep(1)
|
8203
|
+
@driver.action.key_stroke('enter')
|
8204
|
+
sleep(1)
|
8205
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8206
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8207
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8208
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8209
|
+
end
|
7773
8210
|
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
7774
8211
|
sleep(1)
|
7775
8212
|
rescue
|
7776
8213
|
begin
|
7777
|
-
@driver.find_element(:xpath, '
|
7778
|
-
|
8214
|
+
@driver.find_element(:xpath, '//*[@id="captcha_key"]').click
|
8215
|
+
|
7779
8216
|
sleep(1)
|
7780
|
-
|
7781
|
-
el2 = @driver.find_element(:xpath, '//*[@id="
|
8217
|
+
|
8218
|
+
el2 = @driver.find_element(:xpath, '//*[@id="captcha_key"]')
|
7782
8219
|
@driver.action.context_click(el2).perform
|
7783
8220
|
|
7784
8221
|
sleep(1)
|
@@ -7810,11 +8247,11 @@ rescue
|
|
7810
8247
|
sleep(1)
|
7811
8248
|
rescue
|
7812
8249
|
begin
|
7813
|
-
@driver.find_element(:xpath, '
|
7814
|
-
|
8250
|
+
@driver.find_element(:xpath, '=//*[@id="code"]').click
|
8251
|
+
|
7815
8252
|
sleep(1)
|
7816
8253
|
|
7817
|
-
el2 = @driver.find_element(:xpath, '//*[@id="
|
8254
|
+
el2 = @driver.find_element(:xpath, '//*[@id="code"]')
|
7818
8255
|
@driver.action.context_click(el2).perform
|
7819
8256
|
|
7820
8257
|
sleep(1)
|
@@ -7846,13 +8283,13 @@ rescue
|
|
7846
8283
|
sleep(1)
|
7847
8284
|
rescue
|
7848
8285
|
begin
|
7849
|
-
@driver.find_element(:xpath, '//*[@
|
7850
|
-
|
8286
|
+
@driver.find_element(:xpath, '//*[@id="kboard-input-captcha"]').click
|
8287
|
+
|
7851
8288
|
sleep(1)
|
7852
|
-
|
7853
|
-
el2 = @driver.find_element(:xpath, '//*[@
|
8289
|
+
|
8290
|
+
el2 = @driver.find_element(:xpath, '//*[@id="kboard-input-captcha"]')
|
7854
8291
|
@driver.action.context_click(el2).perform
|
7855
|
-
|
8292
|
+
|
7856
8293
|
sleep(1)
|
7857
8294
|
@driver.action.key_stroke('up')
|
7858
8295
|
sleep(1)
|
@@ -7882,23 +8319,24 @@ rescue
|
|
7882
8319
|
sleep(1)
|
7883
8320
|
rescue
|
7884
8321
|
begin
|
7885
|
-
@driver.find_element(:xpath, '//*[@
|
8322
|
+
@driver.find_element(:xpath, '//*[@fw-label="보안문자"]').click
|
8323
|
+
|
7886
8324
|
sleep(1)
|
7887
|
-
|
7888
|
-
|
7889
|
-
el2 = @driver.find_element(:xpath, '//*[@name="captcha"]')
|
7890
|
-
|
7891
|
-
# 우클릭 (context_click) 실행
|
8325
|
+
|
8326
|
+
el2 = @driver.find_element(:xpath, '//*[@fw-label="보안문자"]')
|
7892
8327
|
@driver.action.context_click(el2).perform
|
8328
|
+
|
7893
8329
|
sleep(1)
|
7894
8330
|
@driver.action.key_stroke('up')
|
7895
8331
|
sleep(1)
|
7896
8332
|
@driver.action.key_stroke('up')
|
7897
8333
|
sleep(1)
|
7898
8334
|
@driver.action.key_stroke('enter')
|
8335
|
+
sleep(1)
|
7899
8336
|
begin
|
8337
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
7900
8338
|
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
7901
|
-
|
8339
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
7902
8340
|
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
7903
8341
|
rescue
|
7904
8342
|
sleep(1)
|
@@ -7917,24 +8355,23 @@ rescue
|
|
7917
8355
|
sleep(1)
|
7918
8356
|
rescue
|
7919
8357
|
begin
|
7920
|
-
@driver.find_element(:xpath, '//*[@
|
7921
|
-
|
8358
|
+
@driver.find_element(:xpath, '//*[@name="captcha"]').click
|
7922
8359
|
sleep(1)
|
7923
|
-
|
7924
|
-
|
8360
|
+
|
8361
|
+
# CAPTCHA 요소 찾기
|
8362
|
+
el2 = @driver.find_element(:xpath, '//*[@name="captcha"]')
|
8363
|
+
|
8364
|
+
# 우클릭 (context_click) 실행
|
7925
8365
|
@driver.action.context_click(el2).perform
|
7926
|
-
|
7927
8366
|
sleep(1)
|
7928
8367
|
@driver.action.key_stroke('up')
|
7929
8368
|
sleep(1)
|
7930
8369
|
@driver.action.key_stroke('up')
|
7931
8370
|
sleep(1)
|
7932
8371
|
@driver.action.key_stroke('enter')
|
7933
|
-
sleep(1)
|
7934
8372
|
begin
|
7935
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
7936
8373
|
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
7937
|
-
|
8374
|
+
# 요소가 나타날 때까지 7초 동안 기다립니다.
|
7938
8375
|
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
7939
8376
|
rescue
|
7940
8377
|
sleep(1)
|
@@ -7953,13 +8390,14 @@ rescue
|
|
7953
8390
|
sleep(1)
|
7954
8391
|
rescue
|
7955
8392
|
begin
|
7956
|
-
@driver.find_element(:xpath, '//*[@id="
|
7957
|
-
|
8393
|
+
@driver.find_element(:xpath, '//*[@id="spamCode"]').click
|
8394
|
+
|
7958
8395
|
sleep(1)
|
7959
|
-
|
7960
|
-
el2 = @driver.find_element(:xpath, '//*[@id="
|
8396
|
+
|
8397
|
+
el2 = @driver.find_element(:xpath, '//*[@id="spamCode"]')
|
7961
8398
|
@driver.action.context_click(el2).perform
|
7962
|
-
|
8399
|
+
|
8400
|
+
sleep(1)
|
7963
8401
|
@driver.action.key_stroke('up')
|
7964
8402
|
sleep(1)
|
7965
8403
|
@driver.action.key_stroke('up')
|
@@ -7988,53 +8426,50 @@ rescue
|
|
7988
8426
|
sleep(1)
|
7989
8427
|
rescue
|
7990
8428
|
begin
|
7991
|
-
@driver.
|
7992
|
-
sleep(1)
|
7993
|
-
@driver.find_element(:xpath, '//*[@name="kcaptcha_code"]').click
|
7994
|
-
|
7995
|
-
sleep(1)
|
8429
|
+
@driver.find_element(:xpath, '//*[@id="norobot_code"]').click
|
7996
8430
|
|
7997
|
-
|
7998
|
-
|
7999
|
-
|
8431
|
+
sleep(1)
|
8432
|
+
|
8433
|
+
el2 = @driver.find_element(:xpath, '//*[@id="norobot_code"]')
|
8434
|
+
@driver.action.context_click(el2).perform
|
8435
|
+
|
8436
|
+
@driver.action.key_stroke('up')
|
8437
|
+
sleep(1)
|
8438
|
+
@driver.action.key_stroke('up')
|
8439
|
+
sleep(1)
|
8440
|
+
@driver.action.key_stroke('enter')
|
8441
|
+
sleep(1)
|
8442
|
+
begin
|
8443
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8444
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8445
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8446
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8447
|
+
rescue
|
8000
8448
|
sleep(1)
|
8001
|
-
@driver.action.key_stroke('
|
8449
|
+
@driver.action.key_stroke('left')
|
8002
8450
|
sleep(1)
|
8003
8451
|
@driver.action.key_stroke('up')
|
8004
8452
|
sleep(1)
|
8005
8453
|
@driver.action.key_stroke('enter')
|
8006
|
-
sleep(1)
|
8007
|
-
|
8008
|
-
|
8009
|
-
|
8010
|
-
|
8011
|
-
|
8012
|
-
|
8013
|
-
|
8014
|
-
@driver.action.key_stroke('left')
|
8015
|
-
sleep(1)
|
8016
|
-
@driver.action.key_stroke('up')
|
8017
|
-
sleep(1)
|
8018
|
-
@driver.action.key_stroke('enter')
|
8019
|
-
sleep(1)
|
8020
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
8021
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8022
|
-
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8023
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8024
|
-
end
|
8025
|
-
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8026
|
-
sleep(1)
|
8454
|
+
sleep(1)
|
8455
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8456
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8457
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8458
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8459
|
+
end
|
8460
|
+
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8461
|
+
sleep(1)
|
8027
8462
|
rescue
|
8028
8463
|
begin
|
8029
8464
|
@driver.switch_to.default_content()
|
8030
8465
|
sleep(1)
|
8031
|
-
@driver.find_element(:xpath, '//*[@
|
8032
|
-
|
8466
|
+
@driver.find_element(:xpath, '//*[@name="kcaptcha_code"]').click
|
8467
|
+
|
8033
8468
|
sleep(1)
|
8034
8469
|
|
8035
|
-
el2 = @driver.find_element(:xpath, '//*[@
|
8470
|
+
el2 = @driver.find_element(:xpath, '//*[@name="kcaptcha_code"]')
|
8036
8471
|
@driver.action.context_click(el2).perform
|
8037
|
-
|
8472
|
+
|
8038
8473
|
sleep(1)
|
8039
8474
|
@driver.action.key_stroke('up')
|
8040
8475
|
sleep(1)
|
@@ -8066,13 +8501,13 @@ rescue
|
|
8066
8501
|
begin
|
8067
8502
|
@driver.switch_to.default_content()
|
8068
8503
|
sleep(1)
|
8069
|
-
@driver.find_element(:xpath, '//*[@
|
8070
|
-
|
8504
|
+
@driver.find_element(:xpath, '//*[@title="자동글쓰기방지"]').click
|
8505
|
+
|
8071
8506
|
sleep(1)
|
8072
8507
|
|
8073
|
-
el2 = @driver.find_element(:xpath, '//*[@
|
8508
|
+
el2 = @driver.find_element(:xpath, '//*[@title="자동글쓰기방지"]')
|
8074
8509
|
@driver.action.context_click(el2).perform
|
8075
|
-
|
8510
|
+
|
8076
8511
|
sleep(1)
|
8077
8512
|
@driver.action.key_stroke('up')
|
8078
8513
|
sleep(1)
|
@@ -8104,13 +8539,13 @@ rescue
|
|
8104
8539
|
begin
|
8105
8540
|
@driver.switch_to.default_content()
|
8106
8541
|
sleep(1)
|
8107
|
-
@driver.find_element(:xpath, '//*[@
|
8108
|
-
|
8542
|
+
@driver.find_element(:xpath, '//*[@id="user_captcha"]').click
|
8543
|
+
|
8109
8544
|
sleep(1)
|
8110
8545
|
|
8111
|
-
el2 = @driver.find_element(:xpath, '//*[@
|
8546
|
+
el2 = @driver.find_element(:xpath, '//*[@id="user_captcha"]')
|
8112
8547
|
@driver.action.context_click(el2).perform
|
8113
|
-
|
8548
|
+
|
8114
8549
|
sleep(1)
|
8115
8550
|
@driver.action.key_stroke('up')
|
8116
8551
|
sleep(1)
|
@@ -8142,13 +8577,13 @@ rescue
|
|
8142
8577
|
begin
|
8143
8578
|
@driver.switch_to.default_content()
|
8144
8579
|
sleep(1)
|
8145
|
-
@driver.find_element(:xpath, '//*[@
|
8146
|
-
|
8580
|
+
@driver.find_element(:xpath, '//*[@itemname="자동등록방지"]').click
|
8581
|
+
|
8147
8582
|
sleep(1)
|
8148
8583
|
|
8149
|
-
el2 = @driver.find_element(:xpath, '//*[@
|
8584
|
+
el2 = @driver.find_element(:xpath, '//*[@itemname="자동등록방지"]')
|
8150
8585
|
@driver.action.context_click(el2).perform
|
8151
|
-
|
8586
|
+
|
8152
8587
|
sleep(1)
|
8153
8588
|
@driver.action.key_stroke('up')
|
8154
8589
|
sleep(1)
|
@@ -8177,7 +8612,124 @@ rescue
|
|
8177
8612
|
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8178
8613
|
sleep(1)
|
8179
8614
|
rescue
|
8615
|
+
begin
|
8616
|
+
@driver.switch_to.default_content()
|
8617
|
+
sleep(1)
|
8618
|
+
@driver.find_element(:xpath, '//*[@name="wr_key"]').click
|
8619
|
+
|
8620
|
+
sleep(1)
|
8621
|
+
|
8622
|
+
el2 = @driver.find_element(:xpath, '//*[@name="wr_key"]')
|
8623
|
+
@driver.action.context_click(el2).perform
|
8624
|
+
|
8625
|
+
sleep(1)
|
8626
|
+
@driver.action.key_stroke('up')
|
8627
|
+
sleep(1)
|
8628
|
+
@driver.action.key_stroke('up')
|
8629
|
+
sleep(1)
|
8630
|
+
@driver.action.key_stroke('enter')
|
8631
|
+
sleep(1)
|
8632
|
+
begin
|
8633
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8634
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8635
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8636
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8637
|
+
rescue
|
8638
|
+
sleep(1)
|
8639
|
+
@driver.action.key_stroke('left')
|
8640
|
+
sleep(1)
|
8641
|
+
@driver.action.key_stroke('up')
|
8642
|
+
sleep(1)
|
8643
|
+
@driver.action.key_stroke('enter')
|
8644
|
+
sleep(1)
|
8645
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8646
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8647
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8648
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8649
|
+
end
|
8650
|
+
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8651
|
+
sleep(1)
|
8652
|
+
rescue
|
8653
|
+
begin
|
8654
|
+
@driver.switch_to.default_content()
|
8655
|
+
sleep(1)
|
8656
|
+
@driver.find_element(:xpath, '//*[@title="자동등록방지"]').click
|
8180
8657
|
|
8658
|
+
sleep(1)
|
8659
|
+
|
8660
|
+
el2 = @driver.find_element(:xpath, '//*[@title="자동등록방지"]')
|
8661
|
+
@driver.action.context_click(el2).perform
|
8662
|
+
|
8663
|
+
sleep(1)
|
8664
|
+
@driver.action.key_stroke('up')
|
8665
|
+
sleep(1)
|
8666
|
+
@driver.action.key_stroke('up')
|
8667
|
+
sleep(1)
|
8668
|
+
@driver.action.key_stroke('enter')
|
8669
|
+
sleep(1)
|
8670
|
+
begin
|
8671
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8672
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8673
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8674
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8675
|
+
rescue
|
8676
|
+
sleep(1)
|
8677
|
+
@driver.action.key_stroke('left')
|
8678
|
+
sleep(1)
|
8679
|
+
@driver.action.key_stroke('up')
|
8680
|
+
sleep(1)
|
8681
|
+
@driver.action.key_stroke('enter')
|
8682
|
+
sleep(1)
|
8683
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8684
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8685
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8686
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8687
|
+
end
|
8688
|
+
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8689
|
+
sleep(1)
|
8690
|
+
rescue
|
8691
|
+
begin
|
8692
|
+
@driver.switch_to.default_content()
|
8693
|
+
sleep(1)
|
8694
|
+
@driver.find_element(:xpath, '//input[@name="kcaptcha_img"]').click
|
8695
|
+
|
8696
|
+
sleep(1)
|
8697
|
+
|
8698
|
+
el2 = @driver.find_element(:xpath, '//input[@name="kcaptcha_img"]')
|
8699
|
+
@driver.action.context_click(el2).perform
|
8700
|
+
|
8701
|
+
sleep(1)
|
8702
|
+
@driver.action.key_stroke('up')
|
8703
|
+
sleep(1)
|
8704
|
+
@driver.action.key_stroke('up')
|
8705
|
+
sleep(1)
|
8706
|
+
@driver.action.key_stroke('enter')
|
8707
|
+
sleep(1)
|
8708
|
+
begin
|
8709
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8710
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8711
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8712
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8713
|
+
rescue
|
8714
|
+
sleep(1)
|
8715
|
+
@driver.action.key_stroke('left')
|
8716
|
+
sleep(1)
|
8717
|
+
@driver.action.key_stroke('up')
|
8718
|
+
sleep(1)
|
8719
|
+
@driver.action.key_stroke('enter')
|
8720
|
+
sleep(1)
|
8721
|
+
# 요소 찾기 타임아웃을 7초로 설정
|
8722
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
8723
|
+
#요소가 나타날 때까지 7초 동안 기다립니다.
|
8724
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
8725
|
+
end
|
8726
|
+
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
8727
|
+
sleep(1)
|
8728
|
+
rescue
|
8729
|
+
|
8730
|
+
end
|
8731
|
+
end
|
8732
|
+
end
|
8181
8733
|
end
|
8182
8734
|
end
|
8183
8735
|
end
|
@@ -8189,9 +8741,8 @@ rescue
|
|
8189
8741
|
end
|
8190
8742
|
end
|
8191
8743
|
end
|
8192
|
-
end
|
8193
|
-
|
8194
|
-
##<─────────────────────────────────────────────────────────────────────캡챠 해제 입력 코드 부분
|
8744
|
+
end
|
8745
|
+
|
8195
8746
|
|
8196
8747
|
|
8197
8748
|
|
@@ -8285,7 +8836,8 @@ end
|
|
8285
8836
|
|
8286
8837
|
|
8287
8838
|
|
8288
|
-
|
8839
|
+
else
|
8840
|
+
end
|
8289
8841
|
|
8290
8842
|
|
8291
8843
|
|
@@ -8313,7 +8865,7 @@ sleep(1)
|
|
8313
8865
|
|
8314
8866
|
|
8315
8867
|
##등록 버튼 코드 부분─────────────────────────────────────────────────────────────────────>
|
8316
|
-
|
8868
|
+
|
8317
8869
|
begin
|
8318
8870
|
@driver.find_element(:xpath, '//*[@aria-label="코드 보기"]')
|
8319
8871
|
sleep(1)
|
@@ -8338,7 +8890,7 @@ rescue
|
|
8338
8890
|
@driver.find_element(:xpath, '//*[@title="에디터 타입"]').click
|
8339
8891
|
sleep(1)
|
8340
8892
|
rescue
|
8341
|
-
|
8893
|
+
|
8342
8894
|
end
|
8343
8895
|
end
|
8344
8896
|
end
|
@@ -8519,6 +9071,8 @@ rescue
|
|
8519
9071
|
sleep(1)
|
8520
9072
|
|
8521
9073
|
@driver.find_element(:xpath, '//*[@form="write"]').click
|
9074
|
+
sleep(1)
|
9075
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
8522
9076
|
puts '-[√] 등록을 19번 코드로 시도하였습니다.......'.magenta
|
8523
9077
|
sleep(5)
|
8524
9078
|
|
@@ -8940,7 +9494,6 @@ end
|
|
8940
9494
|
|
8941
9495
|
|
8942
9496
|
|
8943
|
-
|
8944
9497
|
class Wordpress
|
8945
9498
|
include Glimmer
|
8946
9499
|
def get_mac_address
|
@@ -8967,39 +9520,6 @@ class Wordpress
|
|
8967
9520
|
end
|
8968
9521
|
end
|
8969
9522
|
|
8970
|
-
# def get_naver_text(q)
|
8971
|
-
# begin
|
8972
|
-
# Selenium::WebDriver::Chrome::Service.driver_path = './chromedriver.exe'
|
8973
|
-
# @driver = Selenium::WebDriver.for :chrome
|
8974
|
-
# rescue
|
8975
|
-
# @driver = Selenium::WebDriver.for :chrome
|
8976
|
-
# end
|
8977
|
-
# @driver.get('https://search.naver.com/search.naver?display=15&f=&filetype=0&page=3&query='+q.to_s+'&research_url=&sm=tab_pge&start=16&where=web')
|
8978
|
-
# noko = Nokogiri::HTML(@driver.page_source)
|
8979
|
-
# tt = noko.xpath('//*[@id="main_pack"]/section/div/ul').text
|
8980
|
-
# aa33 = '하였습니다,하였어요,하게됬어요,했답니다,했었는데요,하게되었어요,했어요,그랬답니다,그랬어요,합니다,그랬어요,그랬답니다,그랬답니다,그러합니다,좋아요,좋습니다,됬어요,되었어요,되었답니다,되었구요,되었어요,되네요,하네요,해요,할거예요,할수었이요,입니다,인데요,이예요,이랍니다,이였어요,그랬어요,그랬거든요,그랬습니다,었어요,었습니다,있었어요'.split(',')
|
8981
|
-
# for page in 3..8
|
8982
|
-
# @driver.get('https://www.google.com/search?q='+q.to_s+'&start='+(page*10).to_s)
|
8983
|
-
# noko = Nokogiri::HTML(@driver.page_source)
|
8984
|
-
# for n in 1..15
|
8985
|
-
# tt2 = noko.xpath('//*[@id="rso"]/div['+n.to_s+']/div/div/div[2]/div').text
|
8986
|
-
# if tt2.length < 5
|
8987
|
-
|
8988
|
-
# else
|
8989
|
-
# tt2 = tt2.split('...').join('')+aa3.sample
|
8990
|
-
# tt += tt2
|
8991
|
-
# end
|
8992
|
-
# end
|
8993
|
-
# end
|
8994
|
-
# @driver.close
|
8995
|
-
# tt = tt.split(' ').shuffle.join(' ')[0..1000]
|
8996
|
-
# m = Array.new
|
8997
|
-
# for n in 0..19
|
8998
|
-
# m << tt[(n*100)..(n*100+100)]
|
8999
|
-
# end
|
9000
|
-
# return m.join("\n")
|
9001
|
-
# end
|
9002
|
-
|
9003
9523
|
def get_naver_text(q)
|
9004
9524
|
puts '자동 글 생성을 시작합니다.......'.green
|
9005
9525
|
text_array = Array.new
|
@@ -9376,64 +9896,36 @@ class Wordpress
|
|
9376
9896
|
puts table[10]
|
9377
9897
|
if table[8].to_i > table[10].to_i
|
9378
9898
|
if @data['포스트설정']['테더링'].checked?
|
9379
|
-
puts '
|
9380
|
-
|
9899
|
+
puts 'tedering ip change...'
|
9381
9900
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
9382
|
-
|
9383
9901
|
if status.success?
|
9384
|
-
|
9385
|
-
|
9386
|
-
|
9387
|
-
|
9388
|
-
|
9389
|
-
|
9390
|
-
|
9391
|
-
|
9392
|
-
|
9393
|
-
|
9394
|
-
|
9395
|
-
|
9396
|
-
|
9397
|
-
|
9398
|
-
|
9399
|
-
|
9400
|
-
|
9401
|
-
|
9402
|
-
|
9403
|
-
|
9404
|
-
|
9405
|
-
sleep(5) # 네트워크가 안정될 시간을 더 줍니다.
|
9406
|
-
puts 'adb ok'
|
9407
|
-
sleep(8)
|
9408
|
-
|
9409
|
-
# IP 변경 확인을 위한 람다 함수
|
9410
|
-
robot_ip = lambda do
|
9411
|
-
begin
|
9412
|
-
# IP 변경 확인
|
9413
|
-
http = HTTP.get('https://www.findip.kr/')
|
9414
|
-
noko = Nokogiri::HTML(http.to_s)
|
9415
|
-
|
9416
|
-
current_ip = noko.xpath('/html/body/header/h2').text.strip
|
9417
|
-
if current_ip != @my_ip
|
9418
|
-
@my_ip = current_ip
|
9419
|
-
puts "IP 변경됨[ #{@my_ip} ]"
|
9420
|
-
else
|
9421
|
-
puts "현재 IP: #{@my_ip}"
|
9422
|
-
puts 'IP 변경이 감지되지 않았습니다. 다시 시도합니다...'
|
9423
|
-
sleep(5) # 여유롭게 대기 시간 증가
|
9424
|
-
robot_ip[] # 재시도
|
9425
|
-
end
|
9426
|
-
rescue HTTP::ConnectionError => e
|
9427
|
-
puts "네트워크 오류 발생: #{e.message}. 재시도 중..."
|
9428
|
-
sleep(5) # 재시도 간 여유 시간 추가
|
9429
|
-
retry # 재시도
|
9902
|
+
device_id = stdout.split("\n")[1].split("\t")[0]
|
9903
|
+
puts device_id
|
9904
|
+
puts 'adb -s '+device_id+' shell svc data disable'
|
9905
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
|
9906
|
+
sleep(3)
|
9907
|
+
puts 'adb -s '+device_id+' shell svc data enable'
|
9908
|
+
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
9909
|
+
sleep(3)
|
9910
|
+
puts 'adb ok'
|
9911
|
+
sleep(8)
|
9912
|
+
robot_ip = lambda do
|
9913
|
+
http = HTTP.get('https://www.findip.kr/')
|
9914
|
+
noko = Nokogiri::HTML(http.to_s)
|
9915
|
+
if noko.xpath('/html/body/header/h2').text != @my_ip
|
9916
|
+
@my_ip = noko.xpath('/html/body/header/h2').text
|
9917
|
+
else
|
9918
|
+
puts @my_ip
|
9919
|
+
puts '재시도...'
|
9920
|
+
sleep(3)
|
9921
|
+
robot_ip[]
|
9922
|
+
end
|
9430
9923
|
end
|
9431
|
-
|
9432
|
-
robot_ip[] # IP 확인 시작
|
9924
|
+
robot_ip[]
|
9433
9925
|
else
|
9434
|
-
|
9926
|
+
puts 'adb error pass'
|
9435
9927
|
end
|
9436
|
-
|
9928
|
+
end
|
9437
9929
|
|
9438
9930
|
check_success = 1
|
9439
9931
|
@data['table'][index][-1] = 0
|
@@ -9511,7 +10003,7 @@ class Wordpress
|
|
9511
10003
|
@data['table'].pop
|
9512
10004
|
|
9513
10005
|
#네이버로그인
|
9514
|
-
login_check = naver.login(option['proxy'])
|
10006
|
+
login_check = naver.login(option['proxy'],captcha_key)
|
9515
10007
|
if login_check == 0
|
9516
10008
|
black_users << table[1].to_s
|
9517
10009
|
next
|