duo_blog_cafe_comment 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/duo_blog_cafe_comment.rb +90 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b111b98a63af4dd2b2e72140033b8d19ebf9c6e5b6c81de6c75ef9274f95b78
4
- data.tar.gz: c07c2fb7c3c71540889712a5422ea97d7bb56364152c673d75d0274297a91cdf
3
+ metadata.gz: 1549bef29eb812bdb4b0ce9a5b7abee2d9683767c26cce7defb762a9fa787026
4
+ data.tar.gz: 877087449f0095c2ede208694b2970ab196abe411c26ce0f887fcb958b2f76b1
5
5
  SHA512:
6
- metadata.gz: e044c584d6d3a2389cdda1dd3025f0b36062d1c5dbf408369c18e378368e4bbc4b615af891e8c1ffccebbaeb4f3cfbeaf7fb514ba47b0fd8f774a77b9f0f6a8a
7
- data.tar.gz: ca00cf966532e06fcf67d26a76b1c27414c40ddb5bdebe45f3fe8a7f872493dec2bdec60b1e786888d58aa8e5e02b454e55fb0c63430d4fafb2e24694e4dd057
6
+ metadata.gz: d0bf70c2d6430627433c372831a33b6beb5ade511bcbd6279d4db97f772187b33d265000df9649994c302056d3907a78e4763b75313b162c9b24f9cf9769fd0f
7
+ data.tar.gz: ed8ea994c222366ba81508131ea83c99157faf6787afa8de27fe50f0dff3dcd7142e01968046bb3f1aba6b9ca64d3d4e25ea1c5208b1611393a27e81cb7f5651
@@ -1295,8 +1295,32 @@ class Naver
1295
1295
  sleep(1)
1296
1296
  @driver.switch_to.frame(@driver.find_element(:xpath, '//*[@id="mainFrame"]')) # 아이프레임 선택
1297
1297
  sleep(1)
1298
- @driver.find_element(:xpath, '//*[@id="toplistSpanBlind"]').click
1299
- sleep(2)
1298
+ begin
1299
+ @driver.find_element(:xpath, '//*[@id="toplistSpanBlind"]').click
1300
+ sleep(2)
1301
+ rescue
1302
+ begin
1303
+ @driver.find_element(:xpath, '//*[@class="off itemfont _doNclick _param(false|blog|)"]').click
1304
+ sleep(2)
1305
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5)
1306
+ wait.until { @driver.find_element(:xpath, '//*[@id="toplistSpanBlind"]') }
1307
+ @driver.find_element(:xpath, '//*[@id="toplistSpanBlind"]').click
1308
+ sleep(2)
1309
+ rescue => e
1310
+ @driver.window_handles.each do |handle|
1311
+ @driver.switch_to.window(handle)
1312
+ begin
1313
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
1314
+ puts 'id="toplistSpanBlind" 요소를 찾지 못했습니다.'
1315
+ @driver.close
1316
+ rescue Selenium::WebDriver::Error::WebDriverError => e
1317
+ puts "Failed to close tab: #{e.message}"
1318
+ end
1319
+ end
1320
+ @driver.quit
1321
+ end
1322
+ end
1323
+
1300
1324
 
1301
1325
  begin
1302
1326
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
@@ -1315,22 +1339,49 @@ class Naver
1315
1339
  sleep(2)
1316
1340
  element.send_keys(:return)
1317
1341
  sleep(1)
1318
- rescue
1342
+ rescue => e
1343
+ @driver.window_handles.each do |handle|
1344
+ @driver.switch_to.window(handle)
1345
+ begin
1346
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
1347
+ puts 'class="aline" 요소를 찾지 못했습니다.'
1348
+ @driver.close
1349
+ rescue Selenium::WebDriver::Error::WebDriverError => e
1350
+ puts "Failed to close tab: #{e.message}"
1351
+ end
1352
+ end
1353
+ @driver.quit
1319
1354
  end
1320
1355
  end
1321
1356
 
1322
-
1323
- # WebDriverWait과 expected_conditions 가져오기
1324
- wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 10초 대기
1357
+ begin
1358
+ # WebDriverWait과 expected_conditions 가져오기
1359
+ wait = Selenium::WebDriver::Wait.new(:timeout => 5) # 10초 대기
1360
+
1361
+ # 요소가 화면에 보일 때까지 대기 후 바로 클릭
1362
+ wait.until {
1363
+ el = @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]')
1364
+ el.displayed? # 요소가 화면에 보이는지 확인
1365
+ }
1366
+ # 요소 클릭
1367
+ @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]').click
1368
+ sleep(1)
1369
+ rescue => e
1370
+ @driver.window_handles.each do |handle|
1371
+ @driver.switch_to.window(handle)
1372
+ begin
1373
+ # 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
1374
+ puts 'data-value="30" 요소를 찾지 못했습니다.'
1375
+ @driver.close
1376
+ rescue Selenium::WebDriver::Error::WebDriverError => e
1377
+ puts "Failed to close tab: #{e.message}"
1378
+ end
1379
+ end
1380
+ @driver.quit
1381
+ end
1382
+
1383
+
1325
1384
 
1326
- # 요소가 화면에 보일 때까지 대기 후 바로 클릭
1327
- wait.until {
1328
- el = @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]')
1329
- el.displayed? # 요소가 화면에 보이는지 확인
1330
- }
1331
- # 요소 클릭
1332
- @driver.find_element(:xpath, '//div[@id="changeListCount"]//a[@data-value="30"]').click
1333
- sleep(1)
1334
1385
 
1335
1386
 
1336
1387
  @driver.switch_to.default_content
@@ -2014,9 +2065,34 @@ class Naver
2014
2065
  end
2015
2066
  end
2016
2067
  sleep(1)
2068
+ begin
2017
2069
  element = @driver.find_element(:xpath, '//*[@data-uiselector="writeButton"]')
2018
2070
  @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
2071
+ sleep(2)
2019
2072
  @driver.find_element(:xpath, '//*[@data-uiselector="writeButton"]').click #등록버튼
2073
+ rescue
2074
+ begin
2075
+ element = @driver.find_element(:xpath, '//*[@data-ui-selector="writeButton"]')
2076
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
2077
+ sleep(2)
2078
+ @driver.find_element(:xpath, '//*[@data-ui-selector="writeButton"]').click #등록버튼
2079
+ rescue
2080
+ begin
2081
+ element = @driver.find_element(:xpath, '//*[@class="u_cbox_txt_upload"]')
2082
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
2083
+ sleep(2)
2084
+ @driver.find_element(:xpath, '//*[@class="u_cbox_txt_upload"]').click #등록버튼
2085
+ rescue
2086
+ end
2087
+ begin
2088
+ element = @driver.find_element(:xpath, '//*[@data-log="RPC.write"]')
2089
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
2090
+ sleep(2)
2091
+ @driver.find_element(:xpath, '//*[@data-log="RPC.write"]').click #등록버튼
2092
+ rescue
2093
+ end
2094
+ end
2095
+ end
2020
2096
  puts "#{board_url} [댓글 작성 완료 !!]".cyan
2021
2097
 
2022
2098
  sleep(2)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duo_blog_cafe_comment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-25 00:00:00.000000000 Z
11
+ date: 2025-03-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: File to Clipboard gem
14
14
  email: mymin26@naver.com