cafe_buy_duo 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_buy_duo.rb +28 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f684c0bfb04fc7b144040a0244ad2e38d4003b29715405cc17b68f2c0761c83
4
- data.tar.gz: c190ddc479bdd400946adc46c69e2761478ef44b592ca112321d01bc3e4ad634
3
+ metadata.gz: fc3b65495b2607fbe1774e5ef7dd3ccedf12f6e8bf17757fad8c3d0fe8c3fb73
4
+ data.tar.gz: 6f25dfa33f3df92b0461bb5d2c611ec998cf0b400622643925b8df7a08b19fd6
5
5
  SHA512:
6
- metadata.gz: 54f44a431fce551f24cd4c2ae2517481dad6e72aff009c5ce97d8ca86f249daf8d2dcdf4f682d99462aaf86b41d01a5f5fd010c129949c4dbebb4f9f800e74ac
7
- data.tar.gz: 3433e62c6c647ee6ef15aac73063592a69b5d87f2a10a6db410da5c48800312824883ca2b44371698c3f4d8e1495acc7262d23acf30b762d2c38bb574c76c898
6
+ metadata.gz: 99f17dde80db4cfa1a5cda6718af3ba645ad3b545b23f368c907228d8c11b40768db1c81820fd57b12839085925549d2857a181c54d501761bf8a846eff0d37e
7
+ data.tar.gz: 0b0c6283b3fca08a655aa4cdbcda26922e6b3c98f036675b091f3dd9c92d69b6cd6e4abd0389a82d95e54469573e985620b715535b23424a196a08f9eb368d32
data/lib/cafe_buy_duo.rb CHANGED
@@ -1058,16 +1058,23 @@ end
1058
1058
  JS
1059
1059
  sleep(1)
1060
1060
  # 이미지 등록 버튼 클릭
1061
- @driver.find_element(:xpath, '//*[@id="'+page_id+'"]/div[1]/div/header/div[1]/ul/li[1]/button').click
1062
- sleep(3)
1063
- #key_stroke('escape')
1061
+ # 기다릴 시간 설정
1062
+ wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1063
+ # 요소가 나타날 때까지 기다립니다.
1064
+ 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"]') }
1065
+ # 해당 버튼을 찾고 클릭
1066
+ 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"]')
1067
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", image_button) # 크롤 이동
1068
+ sleep(1)
1069
+ @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
1070
+ sleep(1)
1064
1071
 
1065
1072
  # 파일 경로 변환 (슬래시 -> 백슬래시)
1066
1073
  file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
1067
-
1074
+ sleep(1)
1068
1075
  # 파일 입력 필드 찾기 (input[type="file"])
1069
1076
  file_input = @driver.find_element(:id, 'hidden-file')
1070
-
1077
+ sleep(1)
1071
1078
  # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1072
1079
  file_input.send_keys(file_path)
1073
1080
  sleep(3)
@@ -1079,25 +1086,31 @@ end
1079
1086
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1080
1087
  #요소가 나타날 때까지 60초 동안 기다립니다.
1081
1088
  wait.until { @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]') }
1089
+ element = @driver.find_element(:xpath, '//li[@class="se-toolbar-item se-toolbar-item-resizing"]//button[@data-name="image-resizing"]')
1090
+ @driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", element) # 크롤 이동
1082
1091
  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)
1092
+ aria_expanded = element.attribute('aria-expanded')
1093
+ if aria_expanded == 'false'
1094
+ element.click
1095
+ sleep(1) # 클릭 후 잠시 대기
1096
+ else
1097
+ end
1098
+
1086
1099
  begin
1087
1100
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1088
1101
  #요소가 나타날 때까지 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"]') }
1102
+ 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"]') }
1090
1103
  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
1104
+ @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
1092
1105
  sleep(1)
1093
1106
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1094
1107
  sleep(1)
1095
1108
  rescue
1096
1109
  wait = Selenium::WebDriver::Wait.new(:timeout => 3)
1097
1110
  #요소가 나타날 때까지 60초 동안 기다립니다.
1098
- wait.until { @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]') }
1111
+ 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()="초기화"]') }
1099
1112
  sleep(1)
1100
- @driver.find_element(:xpath, '//span[@class="se-custom-layer-resizing-reset-label" and text()="초기화"]').click
1113
+ @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
1101
1114
  sleep(1)
1102
1115
  @driver.action.key_down(:enter).key_up(:enter).perform #엔터
1103
1116
  sleep(1)
@@ -1106,7 +1119,7 @@ end
1106
1119
  @driver.action.key_down(:down).key_up(:down).perform
1107
1120
 
1108
1121
  end
1109
-
1122
+
1110
1123
 
1111
1124
  if option['사진타이틀'] == 'true'
1112
1125
  begin
@@ -1162,12 +1175,12 @@ end
1162
1175
  sleep(3)
1163
1176
 
1164
1177
  file_path = path.split('/').join("\\") # 윈도우 스타일 경로로 변환
1178
+ sleep(1)
1165
1179
  # 파일 입력 필드 찾기 (input[type="file"])
1166
1180
  file_input = @driver.find_element(:id, "hidden-input")
1167
-
1181
+ sleep(1)
1168
1182
  # send_keys로 파일 경로를 직접 입력하여 파일 업로드
1169
1183
  file_input.send_keys(file_path)
1170
-
1171
1184
  sleep(3)
1172
1185
  begin
1173
1186
  @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_buy_duo
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