cafe_basics 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_basics.rb +28 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f18c2f79ad573c568282070643d09f31f5e2999663ef238d5576cf725906ac16
4
- data.tar.gz: 36104de37c3075f6d4a66687c100adb15bd13914d08625d142ac918012c34e45
3
+ metadata.gz: 63970183fe56cce3bc04a52a9cdf53a3a049923d02cfc62d3eac644c0a389d3d
4
+ data.tar.gz: f80d8aa0b1702ae0e79b358fc3bd18eb8bc482346254d7815510f407ec797d82
5
5
  SHA512:
6
- metadata.gz: 51c37a0a6ae930c30a1381e792a1879c793607704e58a94d0369daa14d5079f5d0e0a8da83e48fd2e97ad0083f9d68f9c4140bfaa7d786c425ad66e590fd6f5b
7
- data.tar.gz: 2a1cc15269b6efa03b5d03b58004a3f50790530c051eb6f2315fcc7796dc63be5e65bfa737790d7ff1abd09135a5da103778c998eb0b3f515b1de2295606b469
6
+ metadata.gz: 974bab3e78ae2561cec35e03c29564d7440d49c93eabd0e0e0e21866e0c83f720a96c934b4fdb983010bbf11725a557a083f986644ab96a246a9318262a201cb
7
+ data.tar.gz: 0ce2d1679f7d226b39b4e8f72d243d27326b2beded20b66f0fd713322d9d196ed586693d42fc185b6362a9f8de054c5a33df284ec651999e14a32a100df22d30
data/lib/cafe_basics.rb CHANGED
@@ -739,16 +739,23 @@ class Naver
739
739
  JS
740
740
  sleep(1)
741
741
  # 이미지 등록 버튼 클릭
742
- @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[1]/button').click
743
- sleep(3)
744
- #key_stroke('escape')
742
+ # 기다릴 시간 설정
743
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
744
+ # 요소가 나타날 때까지 기다립니다.
745
+ wait.until { @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]') }
746
+ # 해당 버튼을 찾고 클릭
747
+ image_button = @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]')
748
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", image_button) # 크롤 이동
749
+ sleep(1)
750
+ @driver.find_element(:xpath, '//ul[@class="se-toolbar se-document-toolbar se-toolbar-flexible"]//li[@class="se-toolbar-item se-toolbar-item-image"]//button[@data-name="image"]').click
751
+ sleep(1)
745
752
 
746
753
  # 파일 경로 변환 (슬래시 -> 백슬래시)
747
754
  file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
748
-
755
+ sleep(1)
749
756
  # 파일 입력 필드 찾기 (input[type="file"])
750
757
  file_input = @driver.find_element(:id, 'hidden-file')
751
-
758
+ sleep(1)
752
759
  # send_keys로 파일 경로를 직접 입력하여 파일 업로드
753
760
  file_input.send_keys(file_path)
754
761
  sleep(3)
@@ -760,25 +767,31 @@ class Naver
760
767
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
761
768
  #요소가 나타날 때까지 60초 동안 기다립니다.
762
769
  wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
770
+ element = @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]')
771
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
763
772
  sleep(1)
764
- @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]').click
765
-
766
- sleep(1)
773
+ aria_expanded = element.attribute('aria-expanded')
774
+ if aria_expanded == 'false'
775
+ element.click
776
+ sleep(1) # 클릭 후 잠시 대기
777
+ else
778
+ end
779
+
767
780
  begin
768
781
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
769
782
  #요소가 나타날 때까지 60초 동안 기다립니다.
770
- wait.until { @driver.find_element(:xpath, '//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//button[@class="se-custom-layer-resizing-reset-button"]') }
783
+ wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]') }
771
784
  sleep(1)
772
- @driver.find_element(:xpath, '//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//button[@class="se-custom-layer-resizing-reset-button"]').click
785
+ @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]').click
773
786
  sleep(1)
774
787
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
775
788
  sleep(1)
776
789
  rescue
777
790
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
778
791
  #요소가 나타날 때까지 60초 동안 기다립니다.
779
- wait.until { @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
792
+ wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
780
793
  sleep(1)
781
- @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
794
+ @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//div[@class="se-custom-layer-resizing-option-group"]//button[@class="se-custom-layer-resizing-reset-button"]//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
782
795
  sleep(1)
783
796
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
784
797
  sleep(1)
@@ -787,7 +800,7 @@ class Naver
787
800
  @driver.action.key_down(:down).key_up(:down).perform
788
801
 
789
802
  end
790
-
803
+
791
804
 
792
805
  if option['사진타이틀'] == 'true'
793
806
  begin
@@ -843,12 +856,12 @@ class Naver
843
856
  sleep(3)
844
857
 
845
858
  file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
859
+ sleep(1)
846
860
  # 파일 입력 필드 찾기 (input[type="file"])
847
861
  file_input = @driver.find_element(:id, "hidden-input")
848
-
862
+ sleep(1)
849
863
  # send_keys로 파일 경로를 직접 입력하여 파일 업로드
850
864
  file_input.send_keys(file_path)
851
-
852
865
  sleep(3)
853
866
  begin
854
867
  @driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_basics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - zon