Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Keyword `Input Password` throws an exception when run with Python (no robotframework)

未关闭
#1,746 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
testing-qa

调研方向

从 SeleniumLibrary/keywords/formelement.py 中的 input_password 和 _input_text_into_text_field 开始,它们是 traceback 中显示的入口点。在 Robot Framework 之外复现该调用,然后检查现有的表单元素关键字测试。完成的标准是 Input Password 在有和没有 Robot Framework 执行上下文的情况下都能正常工作,并且针对所报告的故障有回归测试覆盖。

由索引模型根据 Issue 内容生成。

描述

bug priority: high

For issues

Steps to reproduce the issue

from SeleniumLibrary import SeleniumLibrary
from time import sleep

library = SeleniumLibrary()

def minimal_task():
    try:
        library.open_browser('https://docs.robocorp.com')
        library.input_password("//input[@aria-label='Search']", "playwright")
        sleep(5)
    finally:
        library.close_all_browsers()
    print("Done.")


if __name__ == "__main__":
    minimal_task()

Error messages and additional information

Traceback (most recent call last):
  File "task.py", line 23, in <module>
    minimal_task()
  File "task.py", line 15, in minimal_task
    library.input_password("//input[@aria-label='Search']", "playwright")
  File "C:\Users\User\AppData\Local\robocorp\live\199e494e4c733ef3\lib\site-packages\SeleniumLibrary\keywords\formelement.py", line 269, in input_password
    self._input_text_into_text_field(locator, password, clear, disable_log=True)
  File "C:\Users\User\AppData\Local\robocorp\live\199e494e4c733ef3\lib\site-packages\SeleniumLibrary\keywords\formelement.py", line 509, in _input_text_into_text_field
    previous_level = BuiltIn().set_log_level("NONE")
  File "C:\Users\User\AppData\Local\robocorp\live\199e494e4c733ef3\lib\site-packages\robot\libraries\BuiltIn.py", line 3006, in set_log_level
    old = self._context.output.set_log_level(level)
  File "C:\Users\User\AppData\Local\robocorp\live\199e494e4c733ef3\lib\site-packages\robot\libraries\BuiltIn.py", line 64, in _context
    return self._get_context()
  File "C:\Users\User\AppData\Local\robocorp\live\199e494e4c733ef3\lib\site-packages\robot\libraries\BuiltIn.py", line 69, in _get_context
    raise RobotNotRunningError('Cannot access execution context')
robot.libraries.BuiltIn.RobotNotRunningError: Cannot access execution context

Expected behavior and actual behavior

Keyword Input Password works with and without Robot Framework

Environment

Browser: default by Open Browser keyword
Browser driver: Gecko
Operating System: Windows 10
Libraries

  • Robot Framework: NOT USED
  • Selenium: 3.141.0
  • SeleniumLibrary: robotframework-seleniumlibrary==5.1.3
  • Interpreter: Python 3.7.5 | packaged by conda-forge | (default, Jan 28 2021, 18:15:34) [MSC v.1916 64 bit (AMD64)] on win32
主要语言
Python
星标
1.5k
派生
787
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

robotframework/SeleniumLibrary 的其他 Issue

查看 robotframework/SeleniumLibrary 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。