• <small id='A3kx1'></small><noframes id='A3kx1'>

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

        量角器:element.getText() 返回一个对象而不是字符串

        时间:2023-10-12
      1. <tfoot id='qbDcP'></tfoot>

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

            <tbody id='qbDcP'></tbody>
        1. <i id='qbDcP'><tr id='qbDcP'><dt id='qbDcP'><q id='qbDcP'><span id='qbDcP'><b id='qbDcP'><form id='qbDcP'><ins id='qbDcP'></ins><ul id='qbDcP'></ul><sub id='qbDcP'></sub></form><legend id='qbDcP'></legend><bdo id='qbDcP'><pre id='qbDcP'><center id='qbDcP'></center></pre></bdo></b><th id='qbDcP'></th></span></q></dt></tr></i><div id='qbDcP'><tfoot id='qbDcP'></tfoot><dl id='qbDcP'><fieldset id='qbDcP'></fieldset></dl></div>
            <legend id='qbDcP'><style id='qbDcP'><dir id='qbDcP'><q id='qbDcP'></q></dir></style></legend>
                • <bdo id='qbDcP'></bdo><ul id='qbDcP'></ul>
                  本文介绍了量角器:element.getText() 返回一个对象而不是字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个元素定义为

                  this.clientRowName = element(by.id('CLIENT_NAME')); //page object file
                  

                  我想阅读这个元素中的文本,它是ABC",但是这样做:var client = page.clientRowName.getText();

                  I want to read the text in this element which is "ABC" but doing: var client = page.clientRowName.getText();

                  返回一个对象而不是一个字符串.有没有其他方法可以获取元素的文本

                  returns an object instead of a string. Is there any other way that I can get the text for the element

                  推荐答案

                  getText() 返回一个promise,你需要解决它:

                  page.clientRowName.getText().then(function (text) {
                      console.log(text);
                  });
                  

                  或者,如果你只想断言文本,让 expect() 为你解析承诺:

                  Or, if you just want to assert the text, let expect() resolve the promise for you:

                  expect(page.clientRowName.getText()).toEqual("ABC");
                  

                  承诺和控制流 文档页面应该可以解决问题.

                  Promises and the Control Flow documentation page should clear things up.

                  这篇关于量角器:element.getText() 返回一个对象而不是字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在下拉 protractorjs e2e 测试中选择选项 下一篇:Protractor 和 Karma 可以一起使用吗?

                  相关文章

                  最新文章

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

                      <tfoot id='m8fK9'></tfoot>

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