fix tk upload

This commit is contained in:
home-dev-pookz
2025-04-18 09:19:17 +08:00
parent 2facef7509
commit 32e5fa980c
+10 -11
View File
@@ -85,7 +85,7 @@ class TiktokVideo(object):
schedule_input_element = self.locator_base.get_by_label('Schedule')
await schedule_input_element.wait_for(state='visible') # 确保按钮可见
await schedule_input_element.click()
await schedule_input_element.click(force=True)
if await self.locator_base.locator('div.TUXButton-content >> text=Allow').count():
await self.locator_base.locator('div.TUXButton-content >> text=Allow').click()
@@ -127,15 +127,11 @@ class TiktokVideo(object):
minute_selector = f"span.tiktok-timepicker-right:has-text('{minute_str}')"
# pick hour first
await page.wait_for_timeout(500) # 等待500毫秒
await page.wait_for_timeout(1000) # 等待500毫秒
await self.locator_base.locator(hour_selector).click()
# click time button again
await page.wait_for_timeout(500) # 等待500毫秒
await scheduled_picker.locator('div.TUXInputBox').nth(0).click()
await page.wait_for_timeout(500) # 等待500毫秒
await page.wait_for_timeout(1000) # 等待500毫秒
# pick minutes after
await scheduled_picker.locator('div.TUXInputBox').nth(0).click()
await page.wait_for_timeout(500) # 等待500毫秒
await self.locator_base.locator(minute_selector).click()
# click title to remove the focus.
@@ -245,12 +241,15 @@ class TiktokVideo(object):
async def change_language(self, page):
# set the language to english
await page.goto("https://www.tiktok.com")
await page.wait_for_url("https://www.tiktok.com/", timeout=100000)
await page.wait_for_selector('#header-more-menu-icon')
await page.wait_for_load_state('domcontentloaded')
await page.wait_for_selector('[data-e2e="nav-more-menu"]')
# 已经设置为英文, 省略这个步骤
if await page.locator('[data-e2e="nav-more-menu"]').text_content() == "More":
return
await page.locator('#header-more-menu-icon').hover()
await page.locator('[data-e2e="nav-more-menu"]').click()
await page.locator('[data-e2e="language-select"]').click()
await page.locator('#lang-setting-popup-list >> text=English').click()
await page.locator('#creator-tools-selection-menu-header >> text=English').click()
async def click_publish(self, page):
success_flag_div = 'div.common-modal-confirm-modal'