JMeter - WebDriver Sampler - waitForPopUp












1















Someone must have done this before, I am trying to work out a comparable command to use in jmeter webdriver sampler (javascript) how to do a waitForPopUp command...there must be a way...I have something that works for waiting for an element, but I can't work it out for a popup..



hope someone can help



thanks



Karl



UPDATE



I am using this code for waiting for an element -



var wait = new support_ui.WebDriverWait(WDS.browser, 5000)
WaitForLogo = function() {
var logo = WDS.browser.findElement(org.openqa.selenium.By.xpath("//img[@src='/images/power/ndpowered.gif']"))
}
wait.until(new com.google.common.base.Function(WaitForLogo))


And this works, but I can't work out how reuse this to wait for a popup, that has no name, in java I have used -



    selenium.waitForPopUp("_blank", "30000");
selenium.selectWindow("_blank");


And that works, but I can't work out an comparable javascript that will work in jmeter for performance, as I can't get java working in jmeter.










share|improve this question

























  • What kind of pop-up it is and what code you use for waiting for an element?

    – Andersson
    Jan 3 '17 at 15:11











  • have updated my post with some more info for you, thanks for answering..

    – Karl
    Jan 3 '17 at 15:18
















1















Someone must have done this before, I am trying to work out a comparable command to use in jmeter webdriver sampler (javascript) how to do a waitForPopUp command...there must be a way...I have something that works for waiting for an element, but I can't work it out for a popup..



hope someone can help



thanks



Karl



UPDATE



I am using this code for waiting for an element -



var wait = new support_ui.WebDriverWait(WDS.browser, 5000)
WaitForLogo = function() {
var logo = WDS.browser.findElement(org.openqa.selenium.By.xpath("//img[@src='/images/power/ndpowered.gif']"))
}
wait.until(new com.google.common.base.Function(WaitForLogo))


And this works, but I can't work out how reuse this to wait for a popup, that has no name, in java I have used -



    selenium.waitForPopUp("_blank", "30000");
selenium.selectWindow("_blank");


And that works, but I can't work out an comparable javascript that will work in jmeter for performance, as I can't get java working in jmeter.










share|improve this question

























  • What kind of pop-up it is and what code you use for waiting for an element?

    – Andersson
    Jan 3 '17 at 15:11











  • have updated my post with some more info for you, thanks for answering..

    – Karl
    Jan 3 '17 at 15:18














1












1








1


1






Someone must have done this before, I am trying to work out a comparable command to use in jmeter webdriver sampler (javascript) how to do a waitForPopUp command...there must be a way...I have something that works for waiting for an element, but I can't work it out for a popup..



hope someone can help



thanks



Karl



UPDATE



I am using this code for waiting for an element -



var wait = new support_ui.WebDriverWait(WDS.browser, 5000)
WaitForLogo = function() {
var logo = WDS.browser.findElement(org.openqa.selenium.By.xpath("//img[@src='/images/power/ndpowered.gif']"))
}
wait.until(new com.google.common.base.Function(WaitForLogo))


And this works, but I can't work out how reuse this to wait for a popup, that has no name, in java I have used -



    selenium.waitForPopUp("_blank", "30000");
selenium.selectWindow("_blank");


And that works, but I can't work out an comparable javascript that will work in jmeter for performance, as I can't get java working in jmeter.










share|improve this question
















Someone must have done this before, I am trying to work out a comparable command to use in jmeter webdriver sampler (javascript) how to do a waitForPopUp command...there must be a way...I have something that works for waiting for an element, but I can't work it out for a popup..



hope someone can help



thanks



Karl



UPDATE



I am using this code for waiting for an element -



var wait = new support_ui.WebDriverWait(WDS.browser, 5000)
WaitForLogo = function() {
var logo = WDS.browser.findElement(org.openqa.selenium.By.xpath("//img[@src='/images/power/ndpowered.gif']"))
}
wait.until(new com.google.common.base.Function(WaitForLogo))


And this works, but I can't work out how reuse this to wait for a popup, that has no name, in java I have used -



    selenium.waitForPopUp("_blank", "30000");
selenium.selectWindow("_blank");


And that works, but I can't work out an comparable javascript that will work in jmeter for performance, as I can't get java working in jmeter.







javascript selenium-webdriver jmeter jmeter-plugins






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 '17 at 15:15







Karl

















asked Jan 3 '17 at 15:05









KarlKarl

320113




320113













  • What kind of pop-up it is and what code you use for waiting for an element?

    – Andersson
    Jan 3 '17 at 15:11











  • have updated my post with some more info for you, thanks for answering..

    – Karl
    Jan 3 '17 at 15:18



















  • What kind of pop-up it is and what code you use for waiting for an element?

    – Andersson
    Jan 3 '17 at 15:11











  • have updated my post with some more info for you, thanks for answering..

    – Karl
    Jan 3 '17 at 15:18

















What kind of pop-up it is and what code you use for waiting for an element?

– Andersson
Jan 3 '17 at 15:11





What kind of pop-up it is and what code you use for waiting for an element?

– Andersson
Jan 3 '17 at 15:11













have updated my post with some more info for you, thanks for answering..

– Karl
Jan 3 '17 at 15:18





have updated my post with some more info for you, thanks for answering..

– Karl
Jan 3 '17 at 15:18












2 Answers
2






active

oldest

votes


















2














I was able to get this working using:



    var sui = JavaImporter(org.openqa.selenium.support.ui)


and:



    wait.until(sui.ExpectedConditions.numberOfWindowsToBe(2))





share|improve this answer

































    0














    In WebDriver Sampler you have the following methods:





    • WDS.browser.switchTo.frame('frame name or handle') - for switching to a frame


    • WDS.browser.switchTo.window('window name or handle') - for switching to a window


    • WDS.browser.switchTo.alert() - for switching to a modal dialog


    • WDS.browser.getWindowHandles() - for getting all open browser window handles


    See JavaDoc on WebDriver.switchTo method and The WebDriver Sampler: Your Top 10 Questions Answered guide for more details.






    share|improve this answer
























    • Thanks for this, but I am looking for a method to wait for the window before switching to it, at the moment it is trying to switch too quickly and the window hasn't opened yet..

      – Karl
      Jan 4 '17 at 9:12











    • ExpectedConditions.numberOfWindowsToBe(), Carl.

      – Dmitri T
      Jan 4 '17 at 9:23











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41446450%2fjmeter-webdriver-sampler-waitforpopup%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    I was able to get this working using:



        var sui = JavaImporter(org.openqa.selenium.support.ui)


    and:



        wait.until(sui.ExpectedConditions.numberOfWindowsToBe(2))





    share|improve this answer






























      2














      I was able to get this working using:



          var sui = JavaImporter(org.openqa.selenium.support.ui)


      and:



          wait.until(sui.ExpectedConditions.numberOfWindowsToBe(2))





      share|improve this answer




























        2












        2








        2







        I was able to get this working using:



            var sui = JavaImporter(org.openqa.selenium.support.ui)


        and:



            wait.until(sui.ExpectedConditions.numberOfWindowsToBe(2))





        share|improve this answer















        I was able to get this working using:



            var sui = JavaImporter(org.openqa.selenium.support.ui)


        and:



            wait.until(sui.ExpectedConditions.numberOfWindowsToBe(2))






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 21 '18 at 10:56









        Billal Begueradj

        5,843132640




        5,843132640










        answered Jan 4 '17 at 11:05









        KarlKarl

        320113




        320113

























            0














            In WebDriver Sampler you have the following methods:





            • WDS.browser.switchTo.frame('frame name or handle') - for switching to a frame


            • WDS.browser.switchTo.window('window name or handle') - for switching to a window


            • WDS.browser.switchTo.alert() - for switching to a modal dialog


            • WDS.browser.getWindowHandles() - for getting all open browser window handles


            See JavaDoc on WebDriver.switchTo method and The WebDriver Sampler: Your Top 10 Questions Answered guide for more details.






            share|improve this answer
























            • Thanks for this, but I am looking for a method to wait for the window before switching to it, at the moment it is trying to switch too quickly and the window hasn't opened yet..

              – Karl
              Jan 4 '17 at 9:12











            • ExpectedConditions.numberOfWindowsToBe(), Carl.

              – Dmitri T
              Jan 4 '17 at 9:23
















            0














            In WebDriver Sampler you have the following methods:





            • WDS.browser.switchTo.frame('frame name or handle') - for switching to a frame


            • WDS.browser.switchTo.window('window name or handle') - for switching to a window


            • WDS.browser.switchTo.alert() - for switching to a modal dialog


            • WDS.browser.getWindowHandles() - for getting all open browser window handles


            See JavaDoc on WebDriver.switchTo method and The WebDriver Sampler: Your Top 10 Questions Answered guide for more details.






            share|improve this answer
























            • Thanks for this, but I am looking for a method to wait for the window before switching to it, at the moment it is trying to switch too quickly and the window hasn't opened yet..

              – Karl
              Jan 4 '17 at 9:12











            • ExpectedConditions.numberOfWindowsToBe(), Carl.

              – Dmitri T
              Jan 4 '17 at 9:23














            0












            0








            0







            In WebDriver Sampler you have the following methods:





            • WDS.browser.switchTo.frame('frame name or handle') - for switching to a frame


            • WDS.browser.switchTo.window('window name or handle') - for switching to a window


            • WDS.browser.switchTo.alert() - for switching to a modal dialog


            • WDS.browser.getWindowHandles() - for getting all open browser window handles


            See JavaDoc on WebDriver.switchTo method and The WebDriver Sampler: Your Top 10 Questions Answered guide for more details.






            share|improve this answer













            In WebDriver Sampler you have the following methods:





            • WDS.browser.switchTo.frame('frame name or handle') - for switching to a frame


            • WDS.browser.switchTo.window('window name or handle') - for switching to a window


            • WDS.browser.switchTo.alert() - for switching to a modal dialog


            • WDS.browser.getWindowHandles() - for getting all open browser window handles


            See JavaDoc on WebDriver.switchTo method and The WebDriver Sampler: Your Top 10 Questions Answered guide for more details.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 4 '17 at 4:22









            Dmitri TDmitri T

            70.7k33659




            70.7k33659













            • Thanks for this, but I am looking for a method to wait for the window before switching to it, at the moment it is trying to switch too quickly and the window hasn't opened yet..

              – Karl
              Jan 4 '17 at 9:12











            • ExpectedConditions.numberOfWindowsToBe(), Carl.

              – Dmitri T
              Jan 4 '17 at 9:23



















            • Thanks for this, but I am looking for a method to wait for the window before switching to it, at the moment it is trying to switch too quickly and the window hasn't opened yet..

              – Karl
              Jan 4 '17 at 9:12











            • ExpectedConditions.numberOfWindowsToBe(), Carl.

              – Dmitri T
              Jan 4 '17 at 9:23

















            Thanks for this, but I am looking for a method to wait for the window before switching to it, at the moment it is trying to switch too quickly and the window hasn't opened yet..

            – Karl
            Jan 4 '17 at 9:12





            Thanks for this, but I am looking for a method to wait for the window before switching to it, at the moment it is trying to switch too quickly and the window hasn't opened yet..

            – Karl
            Jan 4 '17 at 9:12













            ExpectedConditions.numberOfWindowsToBe(), Carl.

            – Dmitri T
            Jan 4 '17 at 9:23





            ExpectedConditions.numberOfWindowsToBe(), Carl.

            – Dmitri T
            Jan 4 '17 at 9:23


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41446450%2fjmeter-webdriver-sampler-waitforpopup%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]