Forum Discussion

blimden's avatar
blimden
Occasional Contributor
5 years ago

Can't catch change at CSS/JS element

Hello, I need to catch button changes after user click on it. I have setup automatisation that click on this button, but I can't catch that it changes. To html tag button by JS adding "style='display...
  • Wamboo's avatar
    Wamboo
    5 years ago

    The function responsible for adding .copied class on the page can be found in the console:

    its content is this:

     

    var clpMainPmcode = new ClipboardJS('.copy-btn-bonus');
    var tooltip = '<span id="tooltiptext">u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E!</span>';
    clpMainPmcode.on('success', function(s) {
        $('.copy-btn-bonus').addClass('copied');
        $('#go').addClass('bold-text');
        $('.pm-code-inr').append(tooltip);

        setTimeout(function() {
            $('#tooltiptext').remove();
        }, 4000);
    });

     

    1) read the documentation and write your JS -> function using e.g. jquery (to retrieve the newly displayed item) and do whatever you think with it.

     

    Doc link: https://support.smartbear.com/testcomplete/docs/app-testing/web/common-tasks/javascript.html#HowTo

     

    2) Press the button and type in the console:

    var module = $(".copied"); // by classname
    console.log(module)

    you will receive an object in an inspiration that contains the item. Check screen.