Results 1 to 8 of 8

Thread: Timeout waiting for target to be available for ST.future.Element

  1. #1

    Default Timeout waiting for target to be available for ST.future.Element

    Hello guys,

    I am facing a problem with sencha test. Here is the problem

    I run my test and a page open which has two button and by click any of the button the user is directed to his or her home page. Now on the homepage we have a button. I'm trying to click that button but the problem is it is throwing me this error

    Timeout waiting for target to be available for ST.future.Element

    Can you please help me out. Here is the code

    Code:
    describe("invigos Student Clicked", function() {
        it("Larare Button Clicked", function() {
             var a = ST.element('#btnStudent')
            .click(10, 10)
            .wait(30000)
            .and(function(stButton){
                expect(stButton).toBeTruthy();
                alert('Student button clicked');
                debugger;
                  ST.element("#studentJoinAssignmentButton")
                  .click(10, 10).wait(10000)
                    .and(function(el){
                        debugger;
                        alert('abcd');
                    });
            });
           
        });
       
    });
    When ever I run this code I do not see any click happening and it does not comes in the and function


    and one thing more how will I know that ST.element('#someId') has returned me a valid element

    Please help me out. Thanks

  2. #2
    Sencha User
    Join Date
    Mar 2016
    Posts
    59
    Answers
    6

    Default

    If you only do ST.element('#btnStudent') does the test pass? Is #btnStudent the component ID of an Ext Button? Maybe you should use an element ID as '@btnStudent'? Here is some reference for what can be used as a locator string:

    http://docs.sencha.com/sencha_test/2...T.Locator.html

  3. #3

    Default

    Thanks a lot for your responce

    yes #btnStudent is the ID of Ext Button, and yes it does pass when we only try

    Code:
    describe("invigos Student Clicked", function() {
        it("Larare Button Clicked", function() {
             var a = ST.element('#btnStudent')
            .click(10, 10)
            .and(function(){
                 alert('hi');
            })
       });
    });
    and same like #btnStudent, #studentJoinAssignmentButton is also an id of Ext Button, available on next page

  4. #4

    Default

    I did increase the timeout time too but same thing,
    It opens the required page but can't find the required button captured by Event Recorder

  5. #5

    Default

    Hi,
    Will you please help me.?
    Thanks

  6. #6
    Sencha User
    Join Date
    Mar 2016
    Posts
    59
    Answers
    6

    Default

    When it navigates to the required page did you open dev tools on the browser and try to locate the element via ST.find()? This function uses the same syntax for a locator as the ST futures API does.

    The procedure roughly would be:

    Code:
    describe("invigos Student Clicked", function() {
        it("Larare Button Clicked", function() {
             var a = ST.element('#btnStudent')
            .click(10, 10)
            .and(function(){
                 debugger // this should pause Sencha Studio so that you can open dev tools in the target browser
                 // and run commands like ST.find('#btnStudent') and examine the elements in the page etc...
                 alert('hi');
            })
       });
    });

  7. #7

    Default

    Hi,
    When i put a debugger as you suggested, and try to find #btnStudent it works, it return me the button with its id, text style etc

    But when i pit a send an el in and function like .and(function(el){ }))
    it shows me that el is a button . But the functions like .getUrl and .navigate() are not working with it.

    And when i put a wait then it doesn't stop on debugger
    Code:
    describe("invigos Student Clicked", function() {
        it("Larare Button Clicked", function() {
             var a = ST.element('#btnStudent')
            .click(10, 10).wait(2000)
    
            .and(function(){
                 debugger
                 
                 alert('hi');
            })
       });
    });
    because i want a little wait here so it renders to the next page where i can find #studentJoinAssignmentButton .
    Thanks for response


  8. #8
    Sencha User
    Join Date
    Mar 2016
    Posts
    59
    Answers
    6

    Default

    Depending on whether you are using a WebDriver or In-Browser scenario the values will differ... see the explanation/docs here:

    http://docs.sencha.com/sencha_test/2...tml#method-and

    "The future's value is passed as the first argument. For an Element future the arg will be an ST.Element, for components it will be various things, typically the component instance itself. If the scenario is a WebDriver scenario the arg will be the current future such as ST.future.Element above."

    So this tells me that you are running In-Browser. If this is the case and you're script navigates to a different URL then the test will fail as you describe. You must change your scenario to a WebDriver type in the Advanced Section of the Scenario settings. The selected item is darker in color as below:

    scenario-settings.jpg


    If you don't see the Test Type options then you need to change a General setting... with the upper-right gear icon in Studio.

    Screen Shot 2017-03-29 at 10.25.45 AM.jpg

    Then check the General tab and Role:. Make sure that Developer is selected (darker color).

    Screen Shot 2017-03-29 at 10.28.20 AM.png

    The online docs in this area are in the process of being updated so don't reflect this change.
    Attached Images Attached Images

Similar Threads

  1. Timeout waiting for animations
    By tarquin in forum Q&A
    Replies: 4
    Last Post: 14 Sep 2017, 2:38 AM
  2. Replies: 0
    Last Post: 24 Jan 2017, 8:20 AM
  3. [FIXED] "Timeout waiting for window.innerHeight to" error when running the application on iOS
    By owais.zahid in forum Sencha Touch 2.x: Bugs
    Replies: 18
    Last Post: 11 Dec 2014, 3:17 AM
  4. Replies: 0
    Last Post: 21 Sep 2012, 11:31 AM
  5. Replies: 6
    Last Post: 5 Jul 2012, 7:14 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •