【问题标题】:Selenium IDE is not recording with mousedown eventSelenium IDE 没有记录 mousedown 事件
【发布时间】:2015-12-15 17:19:26
【问题描述】:

我创建了一个简单的 div 并在 mousedown 和 mouseup 事件上更改其背景颜色。然后我尝试在 firefox 中使用 Selenium IDE 进行测试。问题是,它没有记录任何鼠标操作。这是 jsfiddle Demo。有什么建议可以解决 Selenium IDE 中的这个问题吗?

 $("#demo").mousedown(function () {
                    $("#demo").css('background-color', 'yellow');
                }).mouseup(function () {
                    $("#demo").css('background-color', 'blue');
                });

<div id="demo" style="width:200px;height:100px;background-color:red;"></div>

即使元素直接添加到 DOM 中,Selenium IDE 也无法正常工作。

【问题讨论】:

    标签: jquery firefox selenium selenium-ide


    【解决方案1】:

    Selenium IDE 不会记录对不可“点击”元素的点击。

    在 Selenium IDE 术语中,这个 &lt;div&gt; 是不可点击的。您必须手动添加此步骤。

    click | id=demo

    来源:https://github.com/SeleniumHQ/selenium/blob/master/ide/main/src/content/recorder-handlers.js#L159

    话虽如此,如果您需要点击该&lt;div&gt;,您可以添加一个空的onclick 属性。

    <div id="demo" onclick style="width:200px;height:100px;background-color:red;"></div>
    

    【讨论】:

    • 感谢您的回复。如何在运行时使用 Mousedown 和 Mouseup 事件进行 Selenium IDE 录制?
    猜你喜欢
    • 1970-01-01
    • 2018-11-18
    • 2016-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多