nblog_zon 0.0.57 → 0.0.59
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/nblog_zon.rb +103 -29
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97a284727453d2d0f0b3616025ec32116ebb3cf931265f4a5511ffaf8f1b27e4
|
4
|
+
data.tar.gz: 20b32196db249730309ed18f02c7dc0fdf45ed4bcb4227f92f2e55230a00d45b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eb2a9f89292260bd27fbade7aa5911107b3fd9770297fb65b8fef09a7b12b3c16f434497886e6d2be4f3a3bdd45cc18c15042848231bfcf7aae728d14c84458
|
7
|
+
data.tar.gz: bbcc23d13a060dfd5ad0c43275b0cf994448f089a2721ff8fd065a7bb63a5da69dd0de6a1b3ef2bb9636cb6b947f1ed25ed07a5f6543f668a35c42a61aa8ed5e
|
data/lib/nblog_zon.rb
CHANGED
@@ -306,55 +306,80 @@ class Naver
|
|
306
306
|
sleep(1)
|
307
307
|
|
308
308
|
begin
|
309
|
-
wait = Selenium::WebDriver::Wait.new(:timeout =>
|
309
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
310
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
311
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
|
312
|
+
sleep(1.5)
|
313
|
+
check_cookie_login = 1
|
314
|
+
puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
|
315
|
+
sleep(2.5)
|
316
|
+
rescue
|
317
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
310
318
|
#요소가 나타날 때까지 3초 동안 기다립니다.
|
311
319
|
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
|
312
320
|
sleep(1.5)
|
313
321
|
@driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
|
314
322
|
check_cookie_login = 0
|
315
323
|
sleep(1)
|
316
|
-
rescue
|
317
|
-
check_cookie_login = 1
|
318
|
-
puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
|
319
|
-
sleep(2.5)
|
320
324
|
end
|
321
325
|
|
322
326
|
if check_cookie_login == 0
|
323
327
|
puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
|
324
328
|
# @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
|
325
329
|
sleep(3)
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
330
|
+
begin
|
331
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
332
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
333
|
+
wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
|
334
|
+
sleep(1.5)
|
335
|
+
@driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
|
336
|
+
sleep(1.5)
|
337
|
+
@driver.find_element(:xpath, '//*[@id="id"]').click
|
338
|
+
Clipboard.copy(user_id)
|
339
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
340
|
+
sleep(1.5)
|
341
|
+
@driver.find_element(:xpath, '//*[@id="pw"]').click
|
342
|
+
Clipboard.copy(user_pw)
|
343
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
344
|
+
sleep(1.5)
|
345
|
+
@driver.find_element(:xpath, '//*[@id="log.login"]').click
|
346
|
+
sleep(2.5)
|
347
|
+
rescue => e
|
348
|
+
puts '-[√] 로딩 지연 접속 실패.......'.red
|
349
|
+
@driver.window_handles.each do |handle|
|
350
|
+
@driver.switch_to.window(handle)
|
351
|
+
begin
|
352
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
353
|
+
@driver.close
|
354
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
355
|
+
puts "Failed to close tab: #{e.message}"
|
356
|
+
end
|
357
|
+
end
|
358
|
+
return 0
|
359
|
+
end
|
342
360
|
|
343
361
|
else
|
344
362
|
# @driver.switch_to.default_content
|
345
363
|
end
|
346
364
|
|
347
365
|
begin
|
348
|
-
wait = Selenium::WebDriver::Wait.new(:timeout =>
|
366
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
349
367
|
#요소가 나타날 때까지 3초 동안 기다립니다.
|
350
368
|
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
|
351
369
|
|
352
370
|
rescue => e
|
353
|
-
puts '-[√] 로그인
|
354
|
-
|
355
|
-
|
371
|
+
puts '-[√] 로그인 실패.......'.red
|
372
|
+
@driver.window_handles.each do |handle|
|
373
|
+
@driver.switch_to.window(handle)
|
374
|
+
begin
|
375
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
376
|
+
@driver.close
|
377
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
378
|
+
puts "Failed to close tab: #{e.message}"
|
379
|
+
end
|
380
|
+
end
|
356
381
|
return 0
|
357
|
-
end
|
382
|
+
end
|
358
383
|
end
|
359
384
|
|
360
385
|
def create_id
|
@@ -654,7 +679,25 @@ class Naver
|
|
654
679
|
end
|
655
680
|
|
656
681
|
|
682
|
+
begin
|
657
683
|
#제목 입력
|
684
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
685
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
686
|
+
wait.until { @driver.find_element(:xpath, '//*[@draggable="false"]') }
|
687
|
+
rescue => e
|
688
|
+
puts '-[√] 글 입력 필드 로딩 지연 접속 실패.......'.red
|
689
|
+
@driver.window_handles.each do |handle|
|
690
|
+
@driver.switch_to.window(handle)
|
691
|
+
begin
|
692
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
693
|
+
@driver.close
|
694
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
695
|
+
puts "Failed to close tab: #{e.message}"
|
696
|
+
end
|
697
|
+
end
|
698
|
+
return 0
|
699
|
+
end
|
700
|
+
|
658
701
|
ele = @driver.find_element(:xpath, '//*[@draggable="false"]')
|
659
702
|
@driver.action.click(ele).perform
|
660
703
|
sleep(0.5)
|
@@ -1539,8 +1582,30 @@ class Naver
|
|
1539
1582
|
end
|
1540
1583
|
|
1541
1584
|
|
1542
|
-
|
1543
|
-
|
1585
|
+
begin
|
1586
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
1587
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
1588
|
+
wait.until { @driver.find_element(:xpath, '//*[@data-focus-lock="publishLayer"]') }
|
1589
|
+
sleep(1.5)
|
1590
|
+
@driver.find_element(:xpath, '//*[@data-focus-lock="publishLayer"]').click #1차 등록버튼
|
1591
|
+
sleep(3)
|
1592
|
+
rescue => e
|
1593
|
+
puts '-[√] 로딩 지연 접속 실패.......'.red
|
1594
|
+
@driver.window_handles.each do |handle|
|
1595
|
+
@driver.switch_to.window(handle)
|
1596
|
+
begin
|
1597
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
1598
|
+
@driver.close
|
1599
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
1600
|
+
puts "Failed to close tab: #{e.message}"
|
1601
|
+
end
|
1602
|
+
end
|
1603
|
+
return 0
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
|
1607
|
+
|
1608
|
+
|
1544
1609
|
category = option['category']
|
1545
1610
|
begin
|
1546
1611
|
p category
|
@@ -1689,11 +1754,20 @@ class Naver
|
|
1689
1754
|
end
|
1690
1755
|
|
1691
1756
|
begin
|
1692
|
-
@driver.
|
1757
|
+
@driver.window_handles.each do |handle|
|
1758
|
+
@driver.switch_to.window(handle)
|
1759
|
+
begin
|
1760
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
1761
|
+
@driver.close
|
1762
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
1763
|
+
puts "Failed to close tab: #{e.message}"
|
1764
|
+
end
|
1765
|
+
end
|
1693
1766
|
rescue
|
1694
1767
|
|
1695
1768
|
end
|
1696
1769
|
|
1770
|
+
|
1697
1771
|
|
1698
1772
|
end
|
1699
1773
|
end
|