cafe_basics 0.0.27 → 0.0.29
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 +97 -26
- 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: f18c2f79ad573c568282070643d09f31f5e2999663ef238d5576cf725906ac16
|
4
|
+
data.tar.gz: 36104de37c3075f6d4a66687c100adb15bd13914d08625d142ac918012c34e45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c37a0a6ae930c30a1381e792a1879c793607704e58a94d0369daa14d5079f5d0e0a8da83e48fd2e97ad0083f9d68f9c4140bfaa7d786c425ad66e590fd6f5b
|
7
|
+
data.tar.gz: 2a1cc15269b6efa03b5d03b58004a3f50790530c051eb6f2315fcc7796dc63be5e65bfa737790d7ff1abd09135a5da103778c998eb0b3f515b1de2295606b469
|
data/lib/cafe_basics.rb
CHANGED
@@ -730,10 +730,18 @@ class Naver
|
|
730
730
|
if i2.to_s.include?('<img')
|
731
731
|
path = i2.to_s.split('src="')[1].split('"')[0]
|
732
732
|
path = URI.decode_www_form(path)[0][0]
|
733
|
+
|
734
|
+
@driver.execute_script(<<~JS)
|
735
|
+
window.URL.createObjectURL = function() {};
|
736
|
+
HTMLInputElement.prototype.click = function() {
|
737
|
+
console.log("File dialog suppressed");
|
738
|
+
};
|
739
|
+
JS
|
740
|
+
sleep(1)
|
733
741
|
# 이미지 등록 버튼 클릭
|
734
742
|
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[1]/button').click
|
735
743
|
sleep(3)
|
736
|
-
key_stroke('escape')
|
744
|
+
#key_stroke('escape')
|
737
745
|
|
738
746
|
# 파일 경로 변환 (슬래시 -> 백슬래시)
|
739
747
|
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
@@ -744,9 +752,43 @@ class Naver
|
|
744
752
|
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
745
753
|
file_input.send_keys(file_path)
|
746
754
|
sleep(3)
|
747
|
-
|
748
755
|
|
749
|
-
|
756
|
+
@driver.action.key_down(:up).key_up(:up).perform
|
757
|
+
sleep(1)
|
758
|
+
|
759
|
+
begin
|
760
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
761
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
762
|
+
wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
|
763
|
+
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)
|
767
|
+
begin
|
768
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
769
|
+
#요소가 나타날 때까지 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"]') }
|
771
|
+
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
|
773
|
+
sleep(1)
|
774
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
775
|
+
sleep(1)
|
776
|
+
rescue
|
777
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
778
|
+
#요소가 나타날 때까지 60초 동안 기다립니다.
|
779
|
+
wait.until { @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
|
780
|
+
sleep(1)
|
781
|
+
@driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
|
782
|
+
sleep(1)
|
783
|
+
@driver.action.key_down(:enter).key_up(:enter).perform #엔터
|
784
|
+
sleep(1)
|
785
|
+
end
|
786
|
+
rescue
|
787
|
+
@driver.action.key_down(:down).key_up(:down).perform
|
788
|
+
|
789
|
+
end
|
790
|
+
|
791
|
+
|
750
792
|
if option['사진타이틀'] == 'true'
|
751
793
|
begin
|
752
794
|
@driver.action.key_down(:up).key_up(:up).perform
|
@@ -784,38 +826,67 @@ class Naver
|
|
784
826
|
elsif i2.to_s.include?('<video')
|
785
827
|
path = i2.to_s.split('src="')[1].split('"')[0]
|
786
828
|
path = URI.decode_www_form(path)[0][0]
|
787
|
-
|
829
|
+
|
788
830
|
@driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[3]/button').click
|
789
831
|
sleep(3)
|
832
|
+
|
833
|
+
|
834
|
+
@driver.execute_script(<<~JS)
|
835
|
+
window.URL.createObjectURL = function() {};
|
836
|
+
HTMLInputElement.prototype.click = function() {
|
837
|
+
console.log("File dialog suppressed");
|
838
|
+
};
|
839
|
+
JS
|
840
|
+
sleep(1)
|
841
|
+
# 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
|
790
842
|
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
|
791
843
|
sleep(3)
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
844
|
+
|
845
|
+
file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
|
846
|
+
# 파일 입력 필드 찾기 (input[type="file"])
|
847
|
+
file_input = @driver.find_element(:id, "hidden-input")
|
848
|
+
|
849
|
+
# send_keys로 파일 경로를 직접 입력하여 파일 업로드
|
850
|
+
file_input.send_keys(file_path)
|
851
|
+
|
797
852
|
sleep(3)
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
853
|
+
begin
|
854
|
+
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
|
855
|
+
sleep(1)
|
856
|
+
rescue
|
857
|
+
end
|
858
|
+
|
859
|
+
begin
|
860
|
+
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
|
861
|
+
sleep(1)
|
862
|
+
rescue
|
863
|
+
end
|
864
|
+
|
865
|
+
begin
|
805
866
|
@driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').send_keys(title)
|
806
|
-
|
867
|
+
sleep(1)
|
868
|
+
rescue
|
869
|
+
end
|
807
870
|
|
808
871
|
for n in 1..10
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
872
|
+
begin
|
873
|
+
puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
|
874
|
+
if @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text == '업로드 완료'
|
875
|
+
break
|
876
|
+
end
|
877
|
+
sleep(10)
|
878
|
+
rescue
|
879
|
+
end
|
814
880
|
end
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
881
|
+
|
882
|
+
begin
|
883
|
+
@driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
|
884
|
+
sleep(3)
|
885
|
+
@driver.action.key_down(:up).key_up(:up).perform #x탭
|
886
|
+
sleep(1)
|
887
|
+
rescue
|
888
|
+
end
|
889
|
+
|
819
890
|
begin
|
820
891
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3)
|
821
892
|
#요소가 나타날 때까지 60초 동안 기다립니다.
|
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.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: File to Clipboard gem
|
14
14
|
email: mymin26@naver.com
|