dreammis commited on
Commit
9ea72a7
·
1 Parent(s): 60a259e

fix tk upload

Browse files
Files changed (1) hide show
  1. uploader/tk_uploader/main_chrome.py +10 -11
uploader/tk_uploader/main_chrome.py CHANGED
@@ -85,7 +85,7 @@ class TiktokVideo(object):
85
  schedule_input_element = self.locator_base.get_by_label('Schedule')
86
  await schedule_input_element.wait_for(state='visible') # 确保按钮可见
87
 
88
- await schedule_input_element.click()
89
  if await self.locator_base.locator('div.TUXButton-content >> text=Allow').count():
90
  await self.locator_base.locator('div.TUXButton-content >> text=Allow').click()
91
 
@@ -127,15 +127,11 @@ class TiktokVideo(object):
127
  minute_selector = f"span.tiktok-timepicker-right:has-text('{minute_str}')"
128
 
129
  # pick hour first
130
- await page.wait_for_timeout(500) # 等待500毫秒
131
  await self.locator_base.locator(hour_selector).click()
132
  # click time button again
133
- await page.wait_for_timeout(500) # 等待500毫秒
134
- await scheduled_picker.locator('div.TUXInputBox').nth(0).click()
135
- await page.wait_for_timeout(500) # 等待500毫秒
136
  # pick minutes after
137
- await scheduled_picker.locator('div.TUXInputBox').nth(0).click()
138
- await page.wait_for_timeout(500) # 等待500毫秒
139
  await self.locator_base.locator(minute_selector).click()
140
 
141
  # click title to remove the focus.
@@ -245,12 +241,15 @@ class TiktokVideo(object):
245
  async def change_language(self, page):
246
  # set the language to english
247
  await page.goto("https://www.tiktok.com")
248
- await page.wait_for_url("https://www.tiktok.com/", timeout=100000)
249
- await page.wait_for_selector('#header-more-menu-icon')
 
 
 
250
 
251
- await page.locator('#header-more-menu-icon').hover()
252
  await page.locator('[data-e2e="language-select"]').click()
253
- await page.locator('#lang-setting-popup-list >> text=English').click()
254
 
255
  async def click_publish(self, page):
256
  success_flag_div = 'div.common-modal-confirm-modal'
 
85
  schedule_input_element = self.locator_base.get_by_label('Schedule')
86
  await schedule_input_element.wait_for(state='visible') # 确保按钮可见
87
 
88
+ await schedule_input_element.click(force=True)
89
  if await self.locator_base.locator('div.TUXButton-content >> text=Allow').count():
90
  await self.locator_base.locator('div.TUXButton-content >> text=Allow').click()
91
 
 
127
  minute_selector = f"span.tiktok-timepicker-right:has-text('{minute_str}')"
128
 
129
  # pick hour first
130
+ await page.wait_for_timeout(1000) # 等待500毫秒
131
  await self.locator_base.locator(hour_selector).click()
132
  # click time button again
133
+ await page.wait_for_timeout(1000) # 等待500毫秒
 
 
134
  # pick minutes after
 
 
135
  await self.locator_base.locator(minute_selector).click()
136
 
137
  # click title to remove the focus.
 
241
  async def change_language(self, page):
242
  # set the language to english
243
  await page.goto("https://www.tiktok.com")
244
+ await page.wait_for_load_state('domcontentloaded')
245
+ await page.wait_for_selector('[data-e2e="nav-more-menu"]')
246
+ # 已经设置为英文, 省略这个步骤
247
+ if await page.locator('[data-e2e="nav-more-menu"]').text_content() == "More":
248
+ return
249
 
250
+ await page.locator('[data-e2e="nav-more-menu"]').click()
251
  await page.locator('[data-e2e="language-select"]').click()
252
+ await page.locator('#creator-tools-selection-menu-header >> text=English').click()
253
 
254
  async def click_publish(self, page):
255
  success_flag_div = 'div.common-modal-confirm-modal'