How to locate/click selector (button) using testcafeHow do JavaScript closures work?How do I detect a click outside an element?Trigger a button click with JavaScript on the Enter key in a text boxHow do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How to get the children of the $(this) selector?<button> vs. <input type=“button” />. Which to use?How do I redirect to another webpage?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

Parameterize chained calls to a utility program in Bash

How dangerous are set-size assumptions?

How does a pilot select the correct ILS when the airport has parallel runways?

Explain why a line can never intersect a plane in exactly two points.

What happens to Cessna electric flaps that are moving when power is lost?

Hot coffee brewing solutions for deep woods camping

Can any NP-Complete Problem be solved using at most polynomial space (but while using exponential time?)

How to avoid voltage drop when using full bridge rectifier as reverse polarity protection

How many people are necessary to maintain modern civilisation?

Array initialization optimization

Do I have any obligations to my PhD supervisor's requests after I have graduated?

Find the C-factor of a vote

How large would a mega structure have to be to host 1 billion people indefinitely?

What was the Shuttle Carrier Aircraft escape tunnel?

How to remove this component from PCB

How do I professionally let my manager know I'll quit over smoking in the office?

Can there be an UN resolution to remove a country from the UNSC?

What does it mean to "control target player"?

Does this Wild Magic result affect the sorcerer or just other creatures?

Can someone suggest a path to study Mordell-Weil theorem for someone studying on their own?

.NET executes a SQL query and Active Monitor shows multiple rows blocking each other

What does "play with your toy’s toys" mean?

Why do textbooks often include the solutions to odd or even numbered problems but not both?

How can I politely work my way around not liking coffee or beer when it comes to professional networking?



How to locate/click selector (button) using testcafe


How do JavaScript closures work?How do I detect a click outside an element?Trigger a button click with JavaScript on the Enter key in a text boxHow do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How to get the children of the $(this) selector?<button> vs. <input type=“button” />. Which to use?How do I redirect to another webpage?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am trying to test the submission of an application using testcafe. However, I don’t seem to be able to get testcafe to click the ‘Submit Application’.



I have tried the following so far:



.click(Selector('button').withText('Submit Applicaition'))
.click('#submit-application').withText('Submit Application')


And a few more options.



I cannot even get testcafe to find the button



import Selector from 'testcafe';

fixture `MES login`
.page `http://mes.coeo.com.au/`;

test('FindButton', async t =>

await t
.wait(2000)
.navigateTo('/le12625-senior-exploration-geologist')
.wait(2000);

const one = await Selector('#submit-application');

const two = one.exists;

await t
.expect(two).ok()

await t
.wait(5000)
.click(Selector(one));



Can anyone give me a hand, explaining whether it is my testcafe script or the way the website is built and how I can make testcafe click the button?



Thanks a lot.



Link to site










share|improve this question



















  • 1





    Your test is working for me, though clicking the button does trigger a javascript error. Can you also add the error you're getting when the test fails?

    – lostlemon
    Mar 25 at 12:41

















1















I am trying to test the submission of an application using testcafe. However, I don’t seem to be able to get testcafe to click the ‘Submit Application’.



I have tried the following so far:



.click(Selector('button').withText('Submit Applicaition'))
.click('#submit-application').withText('Submit Application')


And a few more options.



I cannot even get testcafe to find the button



import Selector from 'testcafe';

fixture `MES login`
.page `http://mes.coeo.com.au/`;

test('FindButton', async t =>

await t
.wait(2000)
.navigateTo('/le12625-senior-exploration-geologist')
.wait(2000);

const one = await Selector('#submit-application');

const two = one.exists;

await t
.expect(two).ok()

await t
.wait(5000)
.click(Selector(one));



Can anyone give me a hand, explaining whether it is my testcafe script or the way the website is built and how I can make testcafe click the button?



Thanks a lot.



Link to site










share|improve this question



















  • 1





    Your test is working for me, though clicking the button does trigger a javascript error. Can you also add the error you're getting when the test fails?

    – lostlemon
    Mar 25 at 12:41













1












1








1








I am trying to test the submission of an application using testcafe. However, I don’t seem to be able to get testcafe to click the ‘Submit Application’.



I have tried the following so far:



.click(Selector('button').withText('Submit Applicaition'))
.click('#submit-application').withText('Submit Application')


And a few more options.



I cannot even get testcafe to find the button



import Selector from 'testcafe';

fixture `MES login`
.page `http://mes.coeo.com.au/`;

test('FindButton', async t =>

await t
.wait(2000)
.navigateTo('/le12625-senior-exploration-geologist')
.wait(2000);

const one = await Selector('#submit-application');

const two = one.exists;

await t
.expect(two).ok()

await t
.wait(5000)
.click(Selector(one));



Can anyone give me a hand, explaining whether it is my testcafe script or the way the website is built and how I can make testcafe click the button?



Thanks a lot.



Link to site










share|improve this question
















I am trying to test the submission of an application using testcafe. However, I don’t seem to be able to get testcafe to click the ‘Submit Application’.



I have tried the following so far:



.click(Selector('button').withText('Submit Applicaition'))
.click('#submit-application').withText('Submit Application')


And a few more options.



I cannot even get testcafe to find the button



import Selector from 'testcafe';

fixture `MES login`
.page `http://mes.coeo.com.au/`;

test('FindButton', async t =>

await t
.wait(2000)
.navigateTo('/le12625-senior-exploration-geologist')
.wait(2000);

const one = await Selector('#submit-application');

const two = one.exists;

await t
.expect(two).ok()

await t
.wait(5000)
.click(Selector(one));



Can anyone give me a hand, explaining whether it is my testcafe script or the way the website is built and how I can make testcafe click the button?



Thanks a lot.



Link to site







javascript button automated-tests e2e-testing testcafe






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 7:50









Alex Skorkin

2,57221837




2,57221837










asked Mar 25 at 8:45









MilkaMilka

82




82







  • 1





    Your test is working for me, though clicking the button does trigger a javascript error. Can you also add the error you're getting when the test fails?

    – lostlemon
    Mar 25 at 12:41












  • 1





    Your test is working for me, though clicking the button does trigger a javascript error. Can you also add the error you're getting when the test fails?

    – lostlemon
    Mar 25 at 12:41







1




1





Your test is working for me, though clicking the button does trigger a javascript error. Can you also add the error you're getting when the test fails?

– lostlemon
Mar 25 at 12:41





Your test is working for me, though clicking the button does trigger a javascript error. Can you also add the error you're getting when the test fails?

– lostlemon
Mar 25 at 12:41












1 Answer
1






active

oldest

votes


















4














Try this solution:



test('FindButton', async t => 
const submitButton = Selector('div#submit-application');
await t
.navigateTo('/le12625-senior-exploration-geologist')
.expect(submitButton.with(visibilityCheck: true).exists)
.ok(timeout: 30000)
.hover(submitButton)
.click(submitButton);

);


and add the --skip-js-errors to the TestCafe command-line options, because when you submit without inputing any field, there is an error on line console.log(this.state.data['State'].value); due to the fact that this.state.data is an empty object






share|improve this answer

























    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%2f55334016%2fhow-to-locate-click-selector-button-using-testcafe%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    Try this solution:



    test('FindButton', async t => 
    const submitButton = Selector('div#submit-application');
    await t
    .navigateTo('/le12625-senior-exploration-geologist')
    .expect(submitButton.with(visibilityCheck: true).exists)
    .ok(timeout: 30000)
    .hover(submitButton)
    .click(submitButton);

    );


    and add the --skip-js-errors to the TestCafe command-line options, because when you submit without inputing any field, there is an error on line console.log(this.state.data['State'].value); due to the fact that this.state.data is an empty object






    share|improve this answer



























      4














      Try this solution:



      test('FindButton', async t => 
      const submitButton = Selector('div#submit-application');
      await t
      .navigateTo('/le12625-senior-exploration-geologist')
      .expect(submitButton.with(visibilityCheck: true).exists)
      .ok(timeout: 30000)
      .hover(submitButton)
      .click(submitButton);

      );


      and add the --skip-js-errors to the TestCafe command-line options, because when you submit without inputing any field, there is an error on line console.log(this.state.data['State'].value); due to the fact that this.state.data is an empty object






      share|improve this answer

























        4












        4








        4







        Try this solution:



        test('FindButton', async t => 
        const submitButton = Selector('div#submit-application');
        await t
        .navigateTo('/le12625-senior-exploration-geologist')
        .expect(submitButton.with(visibilityCheck: true).exists)
        .ok(timeout: 30000)
        .hover(submitButton)
        .click(submitButton);

        );


        and add the --skip-js-errors to the TestCafe command-line options, because when you submit without inputing any field, there is an error on line console.log(this.state.data['State'].value); due to the fact that this.state.data is an empty object






        share|improve this answer













        Try this solution:



        test('FindButton', async t => 
        const submitButton = Selector('div#submit-application');
        await t
        .navigateTo('/le12625-senior-exploration-geologist')
        .expect(submitButton.with(visibilityCheck: true).exists)
        .ok(timeout: 30000)
        .hover(submitButton)
        .click(submitButton);

        );


        and add the --skip-js-errors to the TestCafe command-line options, because when you submit without inputing any field, there is an error on line console.log(this.state.data['State'].value); due to the fact that this.state.data is an empty object







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 21:41









        hdorgevalhdorgeval

        2,556213




        2,556213





























            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%2f55334016%2fhow-to-locate-click-selector-button-using-testcafe%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

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript