【问题标题】:Waiting for an element to be clickable等待元素可点击
【发布时间】:2022-11-28 07:44:19
【问题描述】:

我将以 W3Schools 为例 如果我们去:https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_button_disabled,我们看到按钮是灰色的(禁用),我们如何等待按钮被启用(可点击)。只需更改以下内容即可启用该按钮: <button type="button" disabled>Click Me!</button><button type="button" enabled>Click Me!</button>

我该怎么做才能让剧作家等待启用该元素,然后单击它。

【问题讨论】:

  • 这不是默认行为吗?

标签: python automation playwright


【解决方案1】:

page.click()。例如,对于page.click(selector[, options])剧作家将确保:

  1. 元素附加到 DOM
  2. 元素可见
  3. 元素是稳定的,因为没有动画或完成动画
  4. 元素接收事件,因为没有被其他元素遮挡
  5. 元素已启用

    is_enabled()

【讨论】:

    猜你喜欢
    • 2015-10-11
    • 2016-12-29
    • 2020-02-23
    • 2020-03-29
    • 1970-01-01
    • 1970-01-01
    • 2012-03-26
    • 2020-02-23
    • 1970-01-01
    相关资源
    最近更新 更多