cafe_basics 0.0.27 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- 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: b708f080c9150f084831a31e1a4e5db79da52674dd854f076625f7f78c18f22d
|
4
|
+
data.tar.gz: da2ac58b60ada62e1cb390ddfaa47ba8572221802eb9195f09123e5e41e4d59f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99c14b3415ceb8c3f58870e7283df636e6e1776b8c1c70db84f136a087c4cfbc54c03cb5e0baf274b402b85b73e5e33f26bef00156916fe83c8cb0d03bfc8288
|
7
|
+
data.tar.gz: deac9b4801c263e4e2bcb59745d2ba90c90dc52c1ec79cf04180e5573fe63184f1eaf6403b3e44d6409d57677d9bb05a9ae31c1c503f968264a0d394763e398a
|
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, '//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
|
+
sleep(1)
|
772
|
+
@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
|
+
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, '//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
|
+
sleep(1)
|
781
|
+
@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
|
+
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.30
|
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
|