cafe_basics 0.0.32 → 0.0.35
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/cafe_basics.rb +103 -34
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86e784a5d4c830f83dcce8fa7f2a974fdf3ac25e9de10220c7cef74956766fa6
|
4
|
+
data.tar.gz: d95d50e38c8798a7b629d07427bc6b197314a473a80b716f9233e211bf793751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4809c210cc9cfa202df29fd8f5f62c27d06e7c06fcf3b645f6b5510c6d42079b73a9966d6adcad0c456c7a01274b18e2b81942fc5dbd974c20c0cb73200659e
|
7
|
+
data.tar.gz: 0b205c7896c73baeddf8eed17ca5db33081bf57f1bdf593b7bc8a0f89f58d5ab8089a1522c5863b774164773dbf1cc6ebfb80f750d0622e6c7203dc03ee45145
|
data/lib/cafe_basics.rb
CHANGED
@@ -233,9 +233,9 @@ class Naver
|
|
233
233
|
options.add_argument('--disable-gpu')
|
234
234
|
options.add_argument('--remote-debugging-port=9222')
|
235
235
|
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
236
|
-
@driver = Selenium::WebDriver.for(:chrome,
|
236
|
+
@driver = Selenium::WebDriver.for(:chrome, options: options)
|
237
237
|
rescue
|
238
|
-
@driver = Selenium::WebDriver.for(:chrome,
|
238
|
+
@driver = Selenium::WebDriver.for(:chrome, options: options)
|
239
239
|
end
|
240
240
|
else
|
241
241
|
begin
|
@@ -256,7 +256,7 @@ class Naver
|
|
256
256
|
options.add_argument('--disable-gpu')
|
257
257
|
options.add_argument('--remote-debugging-port=9222')
|
258
258
|
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
259
|
-
@driver = Selenium::WebDriver.for(:chrome,
|
259
|
+
@driver = Selenium::WebDriver.for(:chrome, options: options)
|
260
260
|
rescue => e
|
261
261
|
puts e
|
262
262
|
puts 'proxy error...'
|
@@ -270,9 +270,9 @@ class Naver
|
|
270
270
|
options.add_argument('--disable-gpu')
|
271
271
|
options.add_argument('--remote-debugging-port=9222')
|
272
272
|
options.add_argument('user-data-dir=C:/naver_cookie/' + user_id)
|
273
|
-
@driver = Selenium::WebDriver.for(:chrome,
|
273
|
+
@driver = Selenium::WebDriver.for(:chrome, options: options)
|
274
274
|
rescue
|
275
|
-
@driver = Selenium::WebDriver.for(:chrome,
|
275
|
+
@driver = Selenium::WebDriver.for(:chrome, options: options)
|
276
276
|
end
|
277
277
|
end
|
278
278
|
end
|
@@ -310,39 +310,57 @@ class Naver
|
|
310
310
|
sleep(1)
|
311
311
|
|
312
312
|
begin
|
313
|
-
wait = Selenium::WebDriver::Wait.new(:timeout =>
|
313
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
314
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
315
|
+
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
|
316
|
+
sleep(1.5)
|
317
|
+
check_cookie_login = 1
|
318
|
+
puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
|
319
|
+
sleep(2.5)
|
320
|
+
rescue
|
321
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
314
322
|
#요소가 나타날 때까지 3초 동안 기다립니다.
|
315
323
|
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]') }
|
316
324
|
sleep(1.5)
|
317
325
|
@driver.find_element(:xpath, '//*[@class="MyView-module__link_login___HpHMW"]').click
|
318
326
|
check_cookie_login = 0
|
319
327
|
sleep(1)
|
320
|
-
rescue
|
321
|
-
check_cookie_login = 1
|
322
|
-
puts'[Step.02] 계정 세션 확인!! 로그인 skip.......'.yellow
|
323
|
-
sleep(2.5)
|
324
328
|
end
|
325
329
|
|
326
330
|
if check_cookie_login == 0
|
327
331
|
puts'[Step.02] 계정 세션이 없거나 기간 만료로 인해 로그인 시도.......'.yellow
|
328
332
|
# @driver.find_element(:xpath, '//*[@id="right-content-area"]/div[1]/div[1]/div/a').click
|
329
333
|
sleep(3)
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
334
|
+
begin
|
335
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
336
|
+
#요소가 나타날 때까지 3초 동안 기다립니다.
|
337
|
+
wait.until { @driver.find_element(:xpath, '//*[@for="switch"]') }
|
338
|
+
sleep(1.5)
|
339
|
+
@driver.find_element(:xpath, '//*[@id="login_keep_wrap"]/div[1]/label').click
|
340
|
+
sleep(1.5)
|
341
|
+
@driver.find_element(:xpath, '//*[@id="id"]').click
|
342
|
+
Clipboard.copy(user_id)
|
343
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
344
|
+
sleep(1.5)
|
345
|
+
@driver.find_element(:xpath, '//*[@id="pw"]').click
|
346
|
+
Clipboard.copy(user_pw)
|
347
|
+
@driver.action.key_down(:control).send_keys('v').key_up(:control).perform
|
348
|
+
sleep(1.5)
|
349
|
+
@driver.find_element(:xpath, '//*[@id="log.login"]').click
|
350
|
+
sleep(2.5)
|
351
|
+
rescue => e
|
352
|
+
puts '-[√] 로딩 지연 접속 실패.......'.red
|
353
|
+
@driver.window_handles.each do |handle|
|
354
|
+
@driver.switch_to.window(handle)
|
355
|
+
begin
|
356
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
357
|
+
@driver.close
|
358
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
359
|
+
puts "Failed to close tab: #{e.message}"
|
360
|
+
end
|
361
|
+
end
|
362
|
+
return 0
|
363
|
+
end
|
346
364
|
|
347
365
|
else
|
348
366
|
# @driver.switch_to.default_content
|
@@ -354,11 +372,18 @@ class Naver
|
|
354
372
|
wait.until { @driver.find_element(:xpath, '//*[@class="MyView-module__btn_logout___bsTOJ"]') }
|
355
373
|
|
356
374
|
rescue => e
|
357
|
-
puts '-[√] 로그인
|
358
|
-
|
359
|
-
|
375
|
+
puts '-[√] 로그인 실패.......'.red
|
376
|
+
@driver.window_handles.each do |handle|
|
377
|
+
@driver.switch_to.window(handle)
|
378
|
+
begin
|
379
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
380
|
+
@driver.close
|
381
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
382
|
+
puts "Failed to close tab: #{e.message}"
|
383
|
+
end
|
384
|
+
end
|
360
385
|
return 0
|
361
|
-
end
|
386
|
+
end
|
362
387
|
end
|
363
388
|
|
364
389
|
def create_id
|
@@ -664,8 +689,27 @@ class Naver
|
|
664
689
|
|
665
690
|
|
666
691
|
|
667
|
-
|
692
|
+
|
693
|
+
begin
|
694
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
695
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
696
|
+
wait.until { @driver.find_element(:xpath, '//*[@id="app"]/div/div/section/div/div[2]/div[1]/div[1]/div/div[2]/div/textarea') }
|
697
|
+
sleep(1)
|
668
698
|
@driver.find_element(:xpath, '//*[@id="app"]/div/div/section/div/div[2]/div[1]/div[1]/div/div[2]/div/textarea').send_keys(title)
|
699
|
+
sleep(1)
|
700
|
+
rescue => e
|
701
|
+
puts '-[√] 제목 입력 필드 로딩 지연 접속 실패.......'.red
|
702
|
+
@driver.window_handles.each do |handle|
|
703
|
+
@driver.switch_to.window(handle)
|
704
|
+
begin
|
705
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
706
|
+
@driver.close
|
707
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
708
|
+
puts "Failed to close tab: #{e.message}"
|
709
|
+
end
|
710
|
+
end
|
711
|
+
return 0
|
712
|
+
end
|
669
713
|
|
670
714
|
|
671
715
|
|
@@ -675,8 +719,25 @@ class Naver
|
|
675
719
|
sleep(2)
|
676
720
|
|
677
721
|
sleep(2)
|
678
|
-
|
679
|
-
|
722
|
+
begin
|
723
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
|
724
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
725
|
+
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-bold"]/button[@data-type="toggle" and @data-name="bold"]') }
|
726
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[5]/button').click()
|
727
|
+
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[2]/ul/li[5]/button').click()
|
728
|
+
rescue => e
|
729
|
+
puts '-[√] 글 입력 필드 로딩 지연 접속 실패.......'.red
|
730
|
+
@driver.window_handles.each do |handle|
|
731
|
+
@driver.switch_to.window(handle)
|
732
|
+
begin
|
733
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
734
|
+
@driver.close
|
735
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
736
|
+
puts "Failed to close tab: #{e.message}"
|
737
|
+
end
|
738
|
+
end
|
739
|
+
return 0
|
740
|
+
end
|
680
741
|
sleep(2)
|
681
742
|
@driver.action.key_down(:control).key_down('a').key_up('a').key_up(:control).perform
|
682
743
|
sleep(1)
|
@@ -1593,7 +1654,15 @@ class Naver
|
|
1593
1654
|
|
1594
1655
|
|
1595
1656
|
begin
|
1596
|
-
@driver.
|
1657
|
+
@driver.window_handles.each do |handle|
|
1658
|
+
@driver.switch_to.window(handle)
|
1659
|
+
begin
|
1660
|
+
# 로딩 중이거나, 페이지가 완전히 로딩되지 않더라도 탭을 닫기
|
1661
|
+
@driver.close
|
1662
|
+
rescue Selenium::WebDriver::Error::WebDriverError => e
|
1663
|
+
puts "Failed to close tab: #{e.message}"
|
1664
|
+
end
|
1665
|
+
end
|
1597
1666
|
rescue
|
1598
1667
|
|
1599
1668
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cafe_basics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|