<bdo id='3l0UT'></bdo><ul id='3l0UT'></ul>
    1. <tfoot id='3l0UT'></tfoot>

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

        <small id='3l0UT'></small><noframes id='3l0UT'>

      1. 如何使量角器中的自动化测试脚本等待,直到页

        时间:2023-10-12

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

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

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

        3. <legend id='kXqam'><style id='kXqam'><dir id='kXqam'><q id='kXqam'></q></dir></style></legend>

                <bdo id='kXqam'></bdo><ul id='kXqam'></ul>
                    <tbody id='kXqam'></tbody>
                  本文介绍了如何使量角器中的自动化测试脚本等待,直到页面完全加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  不,但真的!我知道这个通用问题已被问过数千次,但有一些更具体的问题对我来说似乎可行,因此我想知道如何实现它

                  问题

                  我正在使用

                  如果不完全相同,但我如何让量角器挂起,直到页面完全加载

                  重要考虑

                  显然,我可以做很多肮脏的解决方案,比如显式等待.但是我每隔一段时间就会回到这个问题,所以我对这些 70% 的时间都针对特定原因有效的肮脏解决方案不感兴趣

                  附:我认为该按钮会更改 document.load() 事件.但是我不知道我应该在控制台中写什么,以便在我刷新页面时该脚本记录一条消息

                  解决方案

                  你试过了吗

                  await browser.wait(async() =>等待 browser.driver.executeScript('return document.readyState;') === 'loading', 2000).then(() => true, () => true);等待 browser.wait(async () =>await browser.driver.executeScript('return document.readyState;') === '完成', 5000)

                  No, but really! I know this generic question has been asked thousands of times, but there is something more specific that looks feasible to me and thus I want to know how to achieve it

                  The problem

                  I'm testing an angular app with protractor. Inside the app I want to verify that when I click a link I'm being redirected to the right page (non-angular). The problem is that until I reach the page I'm verifying, the url changes 3 times or so (there are multiple redirections happening), so I can't make a waiting function wait until the page is loaded completely

                  What I tried/what won't work for me

                  1. I'm against browser.sleep() for more than 1000 ms!
                  2. browser.waitForAngular() as this is not an angular page
                  3. ExpectedConditions.urlIs() the url is the variable I'm asserting
                  4. ExpectedConditions.presenseOf() the page maybe changing so I can't rely on elements inside
                  5. browser.executeScript("return window.document.readyState") returns compete immediately, though the page is still loading (I was certain this is what I need, but that didn't work either)
                  6. I tried even adding a functions that waits for innerHtml of the whole page not change for at least 3 sec, but it fails because at times there is a pause of more than 3 sec between redirects are happening. Everything above 3 sec isn't a reasonable timeout

                  The question

                  What I noticed is when the browser is loading the page, Reload this page button changes its state to Stop loading this page (X icon) until I'm redirected to the final page (screenshots below). So the question is is there a way to make protractor point to the same condition that chrome uses to choose which icon is displayed?

                  vs

                  And if not exactly the same, but how do I make protractor hang until the page is fully loaded

                  Important to consider

                  Obviously there are a lot of dirty solutions that I can do like explicit waits. But I'm coming back to this question every once in a while, so I'm not interested in these dirty solutions that work 70% of the time for a specific cause

                  P.S. I figured that the button changes the icon on document.load() event. But I can't figure out what should I write in the console in order for that script to log a message when I refresh they page

                  解决方案

                  Have you tried

                  await browser.wait(async () =>
                          await browser.driver.executeScript('return document.readyState;') === 'loading', 2000)
                          .then(() => true, () => true);
                  await browser.wait(async () =>
                          await browser.driver.executeScript('return document.readyState;') === 'complete', 5000)
                  

                  这篇关于如何使量角器中的自动化测试脚本等待,直到页面完全加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:量角器 + 混合 Angular 1+2 应用程序 = 失败 下一篇:在量角器中正确使用页面对象模式

                  相关文章

                  最新文章

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

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

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