【问题标题】:(python) Github Actions test selenium copy paste(python) Github Actions 测试 selenium 复制粘贴
【发布时间】:2021-10-03 12:03:50
【问题描述】:

我正在使用 e2e 测试来测试我的 python 应用程序,并将 github 操作用作我的 CI 的一部分。正常的硒测试工作得很好。我添加了单击以复制功能并希望通过单元测试对其进行测试。到目前为止,我正在使用 pyperclip 来执行此操作:

import pyperclip
link = pyperclip.paste()
assert link == "target link"

在我的机器 (OSX) 上本地一切正常。不幸的是,我无法让这个库在 github 操作上与 ubuntu 一起工作。我收到此错误:

Pyperclip could not find a copy/paste mechanism for your system. Please see https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error for how to fix this.

我已经检查了该页面,但无法使其正常工作。有人知道如何在 github 操作中访问剪贴板吗?

【问题讨论】:

    标签: python django selenium github-actions


    【解决方案1】:

    在运行测试之前尝试在run 命令下面添加

    - name: Install xsel
      run: sudo apt-get install xsel
    

    请查找参考link

    【讨论】:

      猜你喜欢
      • 2021-09-05
      • 2021-06-25
      • 2016-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-19
      • 1970-01-01
      相关资源
      最近更新 更多