wkaisertexas / tiktok-uploader

Automatically ⬆️ upload TikTok videos
https://pypi.org/project/tiktok-uploader/
353 stars 83 forks source link

Schedule and upload not work #139

Open WeslleyMouraDev opened 4 months ago

WeslleyMouraDev commented 4 months ago

Someone know how can i fix this?

Failed to set schedule: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='tux-3']"} (Session info: chrome=124.0.6367.119); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: GetHandleVerifier [0x00F8C213+48259] (No symbol) [0x00F1CB41] (No symbol) [0x00E10A17] (No symbol) [0x00E50BED] (No symbol) [0x00E50C9B] (No symbol) [0x00E8BC12] (No symbol) [0x00E70DE4] (No symbol) [0x00E89B9C] (No symbol) [0x00E70B36] (No symbol) [0x00E4570D] (No symbol) [0x00E462CD] GetHandleVerifier [0x012466A3+2908435] GetHandleVerifier [0x01283CBB+3159851] GetHandleVerifier [0x010251CB+674875] GetHandleVerifier [0x0102B38C+699900] (No symbol) [0x00F26344] (No symbol) [0x00F22398] (No symbol) [0x00F2252C] (No symbol) [0x00F14CB0] BaseThreadInitThunk [0x766B6839+25] RtlGetFullPathName_UEx [0x77D6906F+1215] RtlGetFullPathName_UEx [0x77D6903D+1165]

callum-fortune commented 4 months ago

@WeslleyMouraDev This happens when TikTok changes the structure of their UI. If you can find what tux-3 has been replaced with, you can edit the following line in the toml file...

{"method":"xpath","selector":"//*[@id='tux-3']"}

And that should fix the issue.

romanrsr commented 4 months ago

@WeslleyMouraDev This happens when TikTok changes the structure of their UI. If you can find what tux-3 has been replaced with, you can edit the following line in the toml file...

{"method":"xpath","selector":"//*[@id='tux-3']"}

And that should fix the issue.

I have tried with both tux-1 and tux-3 and am getting the same error:

Failed to set schedule: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='tux-3']"} (Session info: chrome=125.0.6422.61); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: GetHandleVerifier [0x01000B13+45059] (No symbol) [0x00F968A4] (No symbol) [0x00E914FF] (No symbol) [0x00ED205C] (No symbol) [0x00ED210B] (No symbol) [0x00F0E022] (No symbol) [0x00EF2DA4] (No symbol) [0x00F0BF64] (No symbol) [0x00EF2AF6] (No symbol) [0x00EC6948] (No symbol) [0x00EC74CD] GetHandleVerifier [0x012BF9A3+2924179] GetHandleVerifier [0x013136ED+3267549] GetHandleVerifier [0x01084474+584036] GetHandleVerifier [0x0108B1DC+612044] (No symbol) [0x00F9FAB4] (No symbol) [0x00F9C358] (No symbol) [0x00F9C4F7] (No symbol) [0x00F8E46E] BaseThreadInitThunk [0x76E6FCC9+25] RtlGetAppContainerNamedObjectPath [0x778D7C6E+286] RtlGetAppContainerNamedObjectPath [0x778D7C3E+238]

romanrsr commented 3 months ago

This is what tonysmiles mentioned in a PR, but I don't have the knowledge to implement it.

The scheduling issue has been resolved

def __time_picker(driver, hour: int, minute: int) -> None: logger.debug(green('Chọn thời gian'))

`# Tìm và click vào bộ chọn thời gian time_picker = WebDriverWait(driver, config['implicit_wait']).until( EC.element_to_be_clickable((By.CSS_SELECTOR, "#root > div > div > div > div.jsx-480949468.container-v2.form-panel.flow-opt-v1 > div > div.jsx-2745626608.form-v2.reverse.flow-opt-v1 > div.jsx-3395700143 > div > div.jsx-3395700143.scheduled-picker > div:nth-child(1) > div.TUXFormField.TUXTextInput > div.TUXInputBox > div")) ) time_picker.click()

hour_options = driver.find_elements(By.XPATH, "//span[contains(@class, 'tiktok-timepicker-left')]")

minute_options = driver.find_elements(By.XPATH, "//span[contains(@class, 'tiktok-timepicker-right')]")

hour_to_click = hour_options[hour]

minute_option_correct_index = int(minute / 5)

minute_to_click = minute_options[minute]

time.sleep(1) # temporay fix => might be better to use an explicit wait driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", hour_to_click) WebDriverWait(driver, 15).until(EC.visibility_of(hour_to_click)) time.sleep(1) # temporay fix => might be better to use an explicit wait hour_to_click.click()

Tìm và click vào bộ chọn thời gian

time_picker = WebDriverWait(driver, config['implicit_wait']).until( EC.element_to_be_clickable((By.CSS_SELECTOR, "#root > div > div > div > div.jsx-480949468.container-v2.form-panel.flow-opt-v1 > div > div.jsx-2745626608.form-v2.reverse.flow-opt-v1 > div.jsx-3395700143 > div > div.jsx-3395700143.scheduled-picker > div:nth-child(1) > div.TUXFormField.TUXTextInput > div.TUXInputBox > div")) ) time_picker.click()

driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", minute_to_click) WebDriverWait(driver, 30).until(EC.visibility_of(minute_to_click)) time.sleep(2) # temporary fixed => Might be better to use an explicit wait minute_to_click.click()

click somewhere else to close the time picker

time_picker.click()

time.sleep(.5) # wait for the DOM change`

And then @callum-fortune commented this:

That's great that you got it working. Can I suggest using the toml file for references to elements instead of like By.CSS_SELECTOR, "#root > div > div > div > div.jsx-480949468.container-v2.form-panel.flow-opt-v1 > div > div.jsx-2745626608.form-v2.reverse.flow-opt-v1 > div.jsx-3395700143 > div > div.jsx-3395700143.scheduled-picker > div:nth-child(1) > div.TUXFormField.TUXTextInput > div.TUXInputBox > div and you should be able to shorten selectors like that by a lot. Just helps keep it clean and maintainable. Nice work though

romanrsr commented 3 months ago

This is what tonysmiles mentioned in a PR, but I don't have the knowledge to implement it.

The scheduling issue has been resolved

def __time_picker(driver, hour: int, minute: int) -> None: logger.debug(green('Chọn thời gian'))

`# Tìm và click vào bộ chọn thời gian time_picker = WebDriverWait(driver, config['implicit_wait']).until( EC.element_to_be_clickable((By.CSS_SELECTOR, "#root > div > div > div > div.jsx-480949468.container-v2.form-panel.flow-opt-v1 > div > div.jsx-2745626608.form-v2.reverse.flow-opt-v1 > div.jsx-3395700143 > div > div.jsx-3395700143.scheduled-picker > div:nth-child(1) > div.TUXFormField.TUXTextInput > div.TUXInputBox > div")) ) time_picker.click()

hour_options = driver.find_elements(By.XPATH, "//span[contains(@class, 'tiktok-timepicker-left')]")

minute_options = driver.find_elements(By.XPATH, "//span[contains(@class, 'tiktok-timepicker-right')]")

hour_to_click = hour_options[hour]

minute_option_correct_index = int(minute / 5)

minute_to_click = minute_options[minute]

time.sleep(1) # temporay fix => might be better to use an explicit wait driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", hour_to_click) WebDriverWait(driver, 15).until(EC.visibility_of(hour_to_click)) time.sleep(1) # temporay fix => might be better to use an explicit wait hour_to_click.click()

Tìm và click vào bộ chọn thời gian

time_picker = WebDriverWait(driver, config['implicit_wait']).until( EC.element_to_be_clickable((By.CSS_SELECTOR, "#root > div > div > div > div.jsx-480949468.container-v2.form-panel.flow-opt-v1 > div > div.jsx-2745626608.form-v2.reverse.flow-opt-v1 > div.jsx-3395700143 > div > div.jsx-3395700143.scheduled-picker > div:nth-child(1) > div.TUXFormField.TUXTextInput > div.TUXInputBox > div")) ) time_picker.click()

driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", minute_to_click) WebDriverWait(driver, 30).until(EC.visibility_of(minute_to_click)) time.sleep(2) # temporary fixed => Might be better to use an explicit wait minute_to_click.click()

click somewhere else to close the time picker

time_picker.click()

time.sleep(.5) # wait for the DOM change`

And then @callum-fortune commented this:

That's great that you got it working. Can I suggest using the toml file for references to elements instead of like By.CSS_SELECTOR, "#root > div > div > div > div.jsx-480949468.container-v2.form-panel.flow-opt-v1 > div > div.jsx-2745626608.form-v2.reverse.flow-opt-v1 > div.jsx-3395700143 > div > div.jsx-3395700143.scheduled-picker > div:nth-child(1) > div.TUXFormField.TUXTextInput > div.TUXInputBox > div and you should be able to shorten selectors like that by a lot. Just helps keep it clean and maintainable. Nice work though