久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    1. <i id='tMwCk'><tr id='tMwCk'><dt id='tMwCk'><q id='tMwCk'><span id='tMwCk'><b id='tMwCk'><form id='tMwCk'><ins id='tMwCk'></ins><ul id='tMwCk'></ul><sub id='tMwCk'></sub></form><legend id='tMwCk'></legend><bdo id='tMwCk'><pre id='tMwCk'><center id='tMwCk'></center></pre></bdo></b><th id='tMwCk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='tMwCk'><tfoot id='tMwCk'></tfoot><dl id='tMwCk'><fieldset id='tMwCk'></fieldset></dl></div>

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

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

    2. <tfoot id='tMwCk'></tfoot>

      1. <legend id='tMwCk'><style id='tMwCk'><dir id='tMwCk'><q id='tMwCk'></q></dir></style></legend>
      2. 斷言元素被聚焦

        Asserting an element is focused(斷言元素被聚焦)
        <i id='9SIjb'><tr id='9SIjb'><dt id='9SIjb'><q id='9SIjb'><span id='9SIjb'><b id='9SIjb'><form id='9SIjb'><ins id='9SIjb'></ins><ul id='9SIjb'></ul><sub id='9SIjb'></sub></form><legend id='9SIjb'></legend><bdo id='9SIjb'><pre id='9SIjb'><center id='9SIjb'></center></pre></bdo></b><th id='9SIjb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='9SIjb'><tfoot id='9SIjb'></tfoot><dl id='9SIjb'><fieldset id='9SIjb'></fieldset></dl></div>

        <small id='9SIjb'></small><noframes id='9SIjb'>

            <tbody id='9SIjb'></tbody>

              <bdo id='9SIjb'></bdo><ul id='9SIjb'></ul>

                1. <tfoot id='9SIjb'></tfoot>
                  <legend id='9SIjb'><style id='9SIjb'><dir id='9SIjb'><q id='9SIjb'></q></dir></style></legend>

                  本文介紹了斷言元素被聚焦的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  根據我如何斷言一個元素是有焦點的? 線程,您可以通過切換到 activeElement() 來檢查元素是否獲得焦點,并斷言這是您期望獲得焦點的同一元素:

                  According to the How do I assert an element is focused? thread, you can check if an element is focused by switching to an activeElement() and assert this is the same element you've expected to have the focus:

                  expect(page.element.getAttribute('id')).toEqual(browser.driver.switchTo().activeElement().getAttribute('id'));
                  

                  在我的例子中,當前聚焦的元素沒有id屬性.

                  In my case, the currently focused element does not have an id attribute.

                  我應該怎么做而不是檢查 id?

                  What should I do instead of checking an id?

                  獎勵問題:此外,正如您從我嘗試解決它的嘗試中看到的那樣,看起來我不能期望/斷言一個元素(或 Web 元素)作為一個完整的對象.為什么?

                  Bonus question: Also, as you can see from my tries to solve it, it looks like I cannot expect/assert an element (or web element) as a complete object. Why?

                  我試過了:

                  expect(page.element).toEqual(browser.driver.switchTo().activeElement());
                  

                  但是由于我什至無法理解的錯誤而失敗 - 有一個巨大的回溯(在控制臺中滾動大約需要 10 分鐘),但內部沒有用戶友好的錯誤.

                  But is is failing with an error I cannot even understand - there is a huge traceback (it is about 10 minutes to scroll in the console), but no user-friendly error inside.

                  我也嘗試過使用 getWebElement():

                  expect(page.element.getWebElement()).toEqual(browser.driver.switchTo().activeElement());
                  

                  但這導致了以下錯誤:

                  錯誤:期望使用 WebElement 參數調用,期望一個 Promise.做過你的意思是使用 .getText()?

                  Error: expect called with WebElement argument, expected a Promise. Did you mean to use .getText()?

                  使用最新的量角器開發版本.

                  Using the latest protractor development version.

                  推薦答案

                  在我的回答中,我將假設 activeElempageElem 都是量角器元素查找器,并且指向同一個網絡元素.

                  In my answer I'm going to assume activeElem and pageElem are both protractor element finders, and are pointing to the same web element.

                  首先回答你關于為什么的問題

                  First to answer your question about why

                  expect(activeElem).toEqual(pageElem);
                  

                  進入一個無限循環,這是因為量角器在斷言之前修補了jasmine的 expect 以解決promise,因此 expect(activeElem.getText()).toEqual('text'); 無需執行即可工作

                  Gets into an infinite loop, it's because protractor patched jasmine's expect to resolve the promise before asserting, so that things like expect(activeElem.getText()).toEqual('text'); works without having to do

                  activeElem.getText().then(function(text) {
                    expect(text).toEqual('text');
                  })
                  

                  你可以說,為什么不只解決一次承諾呢?但是還有嵌套的 Promise.

                  You could say, why not just resolve the promise once? But then there are nested promises.

                  所以現在您可能會認為這是一個問題,但實際上并不是因為您永遠不會在實際用例中比較兩個 elementFinder.Jasmine 的 toEqual 進行引用檢查,而不是深度比較,因此 expect(activeElem).toEqual(pageElem) 與簡單的引用比較相同:(activeElem === pageElem).toToTruthy(),這樣做真的沒有意義.(注意 element(by.css('html')) === element(by.css('html')) 是假的,因為它不是同一個引用.)

                  So now you might be thinking this is an issue, but it really isn't because you would never compare two elementFinders in a real use case. Jasmine's toEqual does a reference check, and not a deep compare, so expect(activeElem).toEqual(pageElem), is just the same as a simple reference comparison: (activeElem === pageElem).toToTruthy(), and there's really no point doing that. (Note element(by.css('html')) === element(by.css('html')) is false because it's not the same reference.)

                  所以,回答這個線程的真正問題:如何查看兩個 elementFinder 是否具有相同的底層 web 元素:

                  So, to answer the real question for this thread: how to see if two elementFinders have the same underlying webelements:

                  expect(activeElem.getId()).toEqual(pageElem.getId());
                  

                  這篇關于斷言元素被聚焦的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                  <i id='J8lZs'><tr id='J8lZs'><dt id='J8lZs'><q id='J8lZs'><span id='J8lZs'><b id='J8lZs'><form id='J8lZs'><ins id='J8lZs'></ins><ul id='J8lZs'></ul><sub id='J8lZs'></sub></form><legend id='J8lZs'></legend><bdo id='J8lZs'><pre id='J8lZs'><center id='J8lZs'></center></pre></bdo></b><th id='J8lZs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='J8lZs'><tfoot id='J8lZs'></tfoot><dl id='J8lZs'><fieldset id='J8lZs'></fieldset></dl></div>

                        <tbody id='J8lZs'></tbody>
                        <bdo id='J8lZs'></bdo><ul id='J8lZs'></ul>
                        <tfoot id='J8lZs'></tfoot>

                        <legend id='J8lZs'><style id='J8lZs'><dir id='J8lZs'><q id='J8lZs'></q></dir></style></legend>

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

                            主站蜘蛛池模板: 欧美视频一区二区三区 | 日日碰狠狠躁久久躁婷婷 | 91免费在线看 | 婷婷色国产偷v国产偷v小说 | www.国产| 999久久久久久久久 国产欧美在线观看 | 色婷婷综合久久久久中文一区二区 | 国产精品成人久久久久a级 久久蜜桃av一区二区天堂 | 一级黄色在线 | 亚州激情 | 日韩高清在线 | 欧美www在线| 久久综合久 | 精品欧美乱码久久久久久1区2区 | 久久精品在线 | xxxcom在线观看| 91精品久久久久久久久久 | 成人国产精品久久久 | 国产h视频 | 亚洲综合精品 | 国产91丝袜在线播放 | 中文字幕av第一页 | av在线播放国产 | 中文字幕一区在线 | 超碰美女在线 | 欧美老少妇一级特黄一片 | 久久久片| 在线免费观看a级片 | 欧美久久一区二区三区 | 日韩欧美1区2区 | 日韩中文字幕2019 | 中文字幕 视频一区 | 四虎影院新地址 | 欧美精品一区二区三区四区五区 | 99re在线视频| 国产激情在线观看 | 国产小网站 | 国产精品美女一区二区 | 国产精品欧美一区二区三区 | 亚洲精品久久久蜜桃网站 | 色爱综合网|