小编VIS*_*IRE的帖子

通过 Selenium 和 Python 使用带有预期条件的 WebDriverWait 时出现 selenium.common.exceptions.TimeoutException 错误

Traceback (most recent call last):
  File "Inventorytest.py", line 88, in <module>
    j.go_to_application()
  File "Inventorytest.py", line 65, in go_to_application
    EC.element_to_be_clickable((By.ID, 'FavoriteApp_ITEM'))
  File "/home/naroladev/Mercury_Back-End/mercuryenv/lib/python3.6/site-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Run Code Online (Sandbox Code Playgroud)

我在 EC2 服务器实例上遇到了上述异常。我的脚本在 Ubuntu 和 Mac 操作系统以及本地系统上任何版本的 firefox 和 geckodriver 上都可以正常工作。但是 EC2 ubuntu 18.04.01 版本出现上述错误,在此我也尝试升级和降级 firefox 和 geckodriver 版本,但仍然无法正常工作。谁能帮我提供建议和解决方案。

python selenium timeoutexception webdriverwait expected-condition

6
推荐指数
1
解决办法
2万
查看次数

python电报机器人中的回调查询处理程序问题

在我的代码中,我面临callbackquery处理程序的问题,当我点击/start命令Next按钮出现时,当我点击该按钮时,它给我回复hi,直到此输出正确为止。然后当我点击另一个命令/help然后帮助按钮出现时,当我点击那个帮助按钮然后它给我相同的答复 next button is hi

结论:有没有办法杀死旧的callbackquery处理程序。我发现方法是Conversationhandler.ENDcallbackquery处理程序函数返回,但它限制了我在谷歌上搜索的功能,但没有找到预期的输出。

这是我的代码:

 from telegram import InlineKeyboardButton, InlineKeyboardMarkup
 from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, ConversationHandler

 TELEGRAM_HTTP_API_TOKEN = 'token'

 FIRST, SECOND, HELP = range(3)

 def start(bot, update):
        keyboard = [
            [InlineKeyboardButton(u"Next", callback_data=str(FIRST))]
        ]
        reply_markup = InlineKeyboardMarkup(keyboard)
        update.message.reply_text(
            u"Start handler, Press next",
            reply_markup=reply_markup
        )
        return FIRST

 def first(bot, update):
        query = update.callback_query
        #reply_markup = InlineKeyboardMarkup(keyboard)
        bot.send_message(chat_id=query.message.chat_id, …
Run Code Online (Sandbox Code Playgroud)

python python-telegram-bot

5
推荐指数
1
解决办法
712
查看次数