<i id='EVBna'><tr id='EVBna'><dt id='EVBna'><q id='EVBna'><span id='EVBna'><b id='EVBna'><form id='EVBna'><ins id='EVBna'></ins><ul id='EVBna'></ul><sub id='EVBna'></sub></form><legend id='EVBna'></legend><bdo id='EVBna'><pre id='EVBna'><center id='EVBna'></center></pre></bdo></b><th id='EVBna'></th></span></q></dt></tr></i><div id='EVBna'><tfoot id='EVBna'></tfoot><dl id='EVBna'><fieldset id='EVBna'></fieldset></dl></div>

<small id='EVBna'></small><noframes id='EVBna'>

<legend id='EVBna'><style id='EVBna'><dir id='EVBna'><q id='EVBna'></q></dir></style></legend>
    • <bdo id='EVBna'></bdo><ul id='EVBna'></ul>

      1. <tfoot id='EVBna'></tfoot>

        Protractor 中的 `browser.call()` 是什么?

        时间:2023-10-12
        <i id='YmoNe'><tr id='YmoNe'><dt id='YmoNe'><q id='YmoNe'><span id='YmoNe'><b id='YmoNe'><form id='YmoNe'><ins id='YmoNe'></ins><ul id='YmoNe'></ul><sub id='YmoNe'></sub></form><legend id='YmoNe'></legend><bdo id='YmoNe'><pre id='YmoNe'><center id='YmoNe'></center></pre></bdo></b><th id='YmoNe'></th></span></q></dt></tr></i><div id='YmoNe'><tfoot id='YmoNe'></tfoot><dl id='YmoNe'><fieldset id='YmoNe'></fieldset></dl></div>
          <bdo id='YmoNe'></bdo><ul id='YmoNe'></ul>
              <tbody id='YmoNe'></tbody>
            • <tfoot id='YmoNe'></tfoot>
            • <small id='YmoNe'></small><noframes id='YmoNe'>

            • <legend id='YmoNe'><style id='YmoNe'><dir id='YmoNe'><q id='YmoNe'></q></dir></style></legend>
                  本文介绍了Protractor 中的 `browser.call()` 是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我最近正在浏览 Protractor API 并注意到 browser.call() 方法:

                  I've recently being going through the Protractor API and noticed the browser.call() method:

                  安排一个命令在 webdriver 的控制流上下文中执行自定义函数.

                  Schedules a command to execute a custom function within the context of webdriver's control flow.

                  我想将此功能添加到我的工具包中,但我不确定我是否完全了解何时可以在实践中使用它以及它涵盖哪些用例?

                  I would like to add this function to my toolkit, but I am not sure I completely understand when might it be used in practice and what use cases does it cover?

                  推荐答案

                  量角器的工作方式是它有一个内部队列,用于设置函数的顺序.因此,如果您要在测试中的某个地方调用一个函数而不告诉量角器,那么该函数将在队列之外,并且该函数的实际执行可能随时发生.您可以在测试中使用 console.log("something") 进行检查,并查看它们没有按照应用程序的编写顺序执行.

                  the way protractor works is it has an internal queue where it sets the order of your functions. So if you were to call a function somewhere in your test without telling protractor, that function would be outside the queue and the actual execution of the function could happen anytime. You can check that using console.log("something") inside your tests and see that they don't execute in the order the application is written.

                  如果您希望某个函数在 webdriver 事件之后专门运行(意味着您要将其添加到队列中),您可以像这样在 browser.call() 中调用它

                  If you want a function to run specifically after a webdriver event (meaning you want to add it to the queue) you can call it inside the browser.call() like this

                  browser.previousStep();
                  browser.call(functionX, this, parameters...)
                  browser.nextStep()
                  

                  this参数表示:

                  在其范围内执行函数的对象(即 this函数的对象).

                  The object in whose scope to execute the function (i.e. the this object for the function).

                  如文档中所述.

                  这篇关于Protractor 中的 `browser.call()` 是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在量角器测试中设置浏览器时区 下一篇:量角器错误消息“不支持的命令行标志"在铬

                  相关文章

                  最新文章

                      <bdo id='i87dg'></bdo><ul id='i87dg'></ul>

                      <small id='i87dg'></small><noframes id='i87dg'>

                    1. <tfoot id='i87dg'></tfoot>
                      <i id='i87dg'><tr id='i87dg'><dt id='i87dg'><q id='i87dg'><span id='i87dg'><b id='i87dg'><form id='i87dg'><ins id='i87dg'></ins><ul id='i87dg'></ul><sub id='i87dg'></sub></form><legend id='i87dg'></legend><bdo id='i87dg'><pre id='i87dg'><center id='i87dg'></center></pre></bdo></b><th id='i87dg'></th></span></q></dt></tr></i><div id='i87dg'><tfoot id='i87dg'></tfoot><dl id='i87dg'><fieldset id='i87dg'></fieldset></dl></div>
                    2. <legend id='i87dg'><style id='i87dg'><dir id='i87dg'><q id='i87dg'></q></dir></style></legend>