cafe_basics 0.0.30 → 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.
- checksums.yaml +4 -4
- data/lib/cafe_basics.rb +24 -11
- 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: 63970183fe56cce3bc04a52a9cdf53a3a049923d02cfc62d3eac644c0a389d3d
|
4
|
+
data.tar.gz: f80d8aa0b1702ae0e79b358fc3bd18eb8bc482346254d7815510f407ec797d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
743
|
-
|
744
|
-
#
|
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,10 +767,16 @@ 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
|
-
|
765
|
-
|
766
|
-
|
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초 동안 기다립니다.
|
@@ -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)
|