cafe_buy_duo 0.0.27 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cafe_buy_duo.rb +99 -28
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1aee6b511f302ff5547186137dd106fcc05566ba1d8de255d726c2ab2cdf6cc
4
- data.tar.gz: 28af9667aa49110769b88b1f2b0d7bd34d75d09183e55c13ba74ec74bd7985e6
3
+ metadata.gz: 3f684c0bfb04fc7b144040a0244ad2e38d4003b29715405cc17b68f2c0761c83
4
+ data.tar.gz: c190ddc479bdd400946adc46c69e2761478ef44b592ca112321d01bc3e4ad634
5
5
  SHA512:
6
- metadata.gz: ce58f1bb04c689261d415272711eb901644656e09ee67169c1ea0e8c98d4392aac226ce9daeecb9b7b345530fc660817d96ebeca93d3032acfa317280c9e2eb7
7
- data.tar.gz: 8acb442de9c7b7304f18a6a5db61f7eed6d129667d33e285e9c38a810dfa346054657ce5b63cd9bee63030e309759a64e78f4dcce7d86568e3ee8d5519a03695
6
+ metadata.gz: 54f44a431fce551f24cd4c2ae2517481dad6e72aff009c5ce97d8ca86f249daf8d2dcdf4f682d99462aaf86b41d01a5f5fd010c129949c4dbebb4f9f800e74ac
7
+ data.tar.gz: 3433e62c6c647ee6ef15aac73063592a69b5d87f2a10a6db410da5c48800312824883ca2b44371698c3f4d8e1495acc7262d23acf30b762d2c38bb574c76c898
data/lib/cafe_buy_duo.rb CHANGED
@@ -1049,10 +1049,18 @@ end
1049
1049
  if i2.to_s.include?('<img')
1050
1050
  path = i2.to_s.split('src="')[1].split('"')[0]
1051
1051
  path = URI.decode_www_form(path)[0][0]
1052
+
1053
+ @driver.execute_script(<<~JS)
1054
+ window.URL.createObjectURL = function() {};
1055
+ HTMLInputElement.prototype.click = function() {
1056
+ console.log("File dialog suppressed");
1057
+ };
1058
+ JS
1059
+ sleep(1)
1052
1060
  # 이미지 등록 버튼 클릭
1053
1061
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[1]/button').click
1054
1062
  sleep(3)
1055
- key_stroke('escape')
1063
+ #key_stroke('escape')
1056
1064
 
1057
1065
  # 파일 경로 변환 (슬래시 -> 백슬래시)
1058
1066
  file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
@@ -1063,9 +1071,43 @@ end
1063
1071
  # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1064
1072
  file_input.send_keys(file_path)
1065
1073
  sleep(3)
1066
-
1067
1074
 
1068
-
1075
+ @driver.action.key_down(:up).key_up(:up).perform
1076
+ sleep(1)
1077
+
1078
+ begin
1079
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1080
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1081
+ wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
1082
+ sleep(1)
1083
+ @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]').click
1084
+
1085
+ sleep(1)
1086
+ begin
1087
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1088
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1089
+ 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"]') }
1090
+ sleep(1)
1091
+ @driver.find_element(:xpath, '//div[@class="se-custom-layer-option se-custom-layer-option-resizing"]//button[@class="se-custom-layer-resizing-reset-button"]').click
1092
+ sleep(1)
1093
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1094
+ sleep(1)
1095
+ rescue
1096
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1097
+ #요소가 나타날 때까지 60초 동안 기다립니다.
1098
+ wait.until { @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
1099
+ sleep(1)
1100
+ @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
1101
+ sleep(1)
1102
+ @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1103
+ sleep(1)
1104
+ end
1105
+ rescue
1106
+ @driver.action.key_down(:down).key_up(:down).perform
1107
+
1108
+ end
1109
+
1110
+
1069
1111
  if option['사진타이틀'] == 'true'
1070
1112
  begin
1071
1113
  @driver.action.key_down(:up).key_up(:up).perform
@@ -1082,7 +1124,7 @@ end
1082
1124
  rescue
1083
1125
  @driver.action.key_down(:down).key_up(:down).perform
1084
1126
  end
1085
- end
1127
+ end
1086
1128
 
1087
1129
 
1088
1130
  if i2.to_s.split('href="')[1] != nil
@@ -1103,38 +1145,67 @@ end
1103
1145
  elsif i2.to_s.include?('<video')
1104
1146
  path = i2.to_s.split('src="')[1].split('"')[0]
1105
1147
  path = URI.decode_www_form(path)[0][0]
1106
-
1148
+
1107
1149
  @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[3]/button').click
1108
1150
  sleep(3)
1151
+
1152
+
1153
+ @driver.execute_script(<<~JS)
1154
+ window.URL.createObjectURL = function() {};
1155
+ HTMLInputElement.prototype.click = function() {
1156
+ console.log("File dialog suppressed");
1157
+ };
1158
+ JS
1159
+ sleep(1)
1160
+ # 파일 업로드 버튼 클릭 (이제 파일 선택 창이 뜨지 않음)
1109
1161
  @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/fieldset/div[1]/button[1]').click
1110
1162
  sleep(3)
1111
-
1112
- Clipboard.copy(path.split('/').join("\\"))
1113
- key_down('ctrl')
1114
- key_stroke('v')
1115
- key_up('ctrl')
1163
+
1164
+ file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
1165
+ # 파일 입력 필드 찾기 (input[type="file"])
1166
+ file_input = @driver.find_element(:id, "hidden-input")
1167
+
1168
+ # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1169
+ file_input.send_keys(file_path)
1170
+
1116
1171
  sleep(3)
1117
- key_stroke('enter')
1118
- sleep(2)
1119
-
1120
- @driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
1121
- sleep(1)
1122
- @driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
1123
- sleep(1)
1172
+ begin
1173
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_title"]').send_keys(title)
1174
+ sleep(1)
1175
+ rescue
1176
+ end
1177
+
1178
+ begin
1179
+ @driver.find_element(:xpath, '//*[@id="nvu_inp_box_description"]').send_keys(title)
1180
+ sleep(1)
1181
+ rescue
1182
+ end
1183
+
1184
+ begin
1124
1185
  @driver.find_element(:xpath, '//*[@id="nvu_inp_box_tag"]').send_keys(title)
1125
- sleep(1)
1186
+ sleep(1)
1187
+ rescue
1188
+ end
1126
1189
 
1127
1190
  for n in 1..10
1128
- puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
1129
- if @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text == '업로드 완료'
1130
- break
1131
- end
1132
- sleep(10)
1191
+ begin
1192
+ puts @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text
1193
+ if @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[2]/div[1]/ul/li/div/button[1]/div[2]/em').text == '업로드 완료'
1194
+ break
1195
+ end
1196
+ sleep(10)
1197
+ rescue
1198
+ end
1133
1199
  end
1134
- @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
1135
- sleep(3)
1136
- @driver.action.key_down(:up).key_up(:up).perform #x탭
1137
- sleep(1)
1200
+
1201
+ begin
1202
+ @driver.find_element(:xpath, '//*[@id="video-uploader-wrap"]/div/div/div[3]/button/span').click
1203
+ sleep(3)
1204
+ @driver.action.key_down(:up).key_up(:up).perform #x탭
1205
+ sleep(1)
1206
+ rescue
1207
+ end
1208
+
1138
1209
  begin
1139
1210
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1140
1211
  #요소가 나타날 때까지 60초 동안 기다립니다.
@@ -1149,7 +1220,7 @@ end
1149
1220
  rescue
1150
1221
  @driver.action.key_down(:down).key_up(:down).perform
1151
1222
  end
1152
-
1223
+
1153
1224
  elsif i2.to_s.include?('<inyonggoo')
1154
1225
  if i2.text == ''
1155
1226
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cafe_buy_duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
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-01-24 00:00:00.000000000 Z
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