python 自动发布错误raise TimeoutException(message, screen, stacktrace)
这个是错误提示:
Downloading video...Downloaded video!
Challenge the Game discussed mental health, equality and love for the game! - @tiktok - For You
Starting upload...
Traceback (most recent call last):
File "main.py", line 263, in <module>
main()
File "main.py", line 240, in main
upload_file(
File "main.py", line 107, in upload_file
_set_basic_settings(driver, title, description, thumbnail_path)
File "main.py", line 147, in _set_basic_settings
title_input: WebElement = driver.switch_to.frame(WebDriverWait(driver, 20).until(
File "C:\Users\mawanyan\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
这个是代码
def _set_basic_settings(driver: WebDriver, title: str, description: str, thumbnail_path: str = None): title_input: WebElement = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable(
(
By.XPATH,
'//ytcp-mention-textbox[@label="Title"]//div[@id="textbox"]',
)
)
)
# Input meta data (title, description, etc ... )
description_input: WebElement = driver.find_element_by_xpath(
'//ytcp-mention-textbox[@label="Description"]//div[@id="textbox"]'
)
thumbnail_input: WebElement = driver.find_element_by_css_selector(
"input#file-loader"
)
title_input.clear()
title_input.send_keys(title)
description_input.send_keys(description)
if thumbnail_path:
thumbnail_input.send_keys(thumbnail_path)
driver.find_element_by_css_selector("#toggle-button").click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(By.NAME, "NOT_MADE_FOR_KIDS")
)).click()
无法运行,求解!
添加了iframe框架也是这个错误。
回答:
将main.py 第107行注释
#_set_basic_settings(driver, title, description, thumbnail_path)
测试发布成功。
以上是 python 自动发布错误raise TimeoutException(message, screen, stacktrace) 的全部内容, 来源链接: utcz.com/p/938146.html