TypeError: Cannot read property 'document' of null onclick

Get help with testing, discuss unit testing strategies etc.


Post Reply
User avatar
vakhsakhalyan
Posts: 9
Joined: Mon Apr 09, 2018 4:10 pm

TypeError: Cannot read property 'document' of null onclick

Post by vakhsakhalyan »

I have updated Siesta to servion 5.0.0. and have a problem with click event.
After click on some element I get this error:
TypeError: Cannot read property 'document' of null. Here is a smaal part of code:

Code: Select all

  loginBtn    = tExt.ComponentQuery.query('#login')[0]; t.chain(

                        function(next) {
                            t.click(loginBtn, callback);
                        }
)
.
What is wrong in this code?
Last edited by vakhsakhalyan on Fri Aug 31, 2018 9:35 am, edited 1 time in total.

User avatar
nickolay
Core Developer
Core Developer
Posts: 3450
Joined: Mon May 16, 2011 10:48 am

Re: TypeError: Cannot read property 'document' of null oncli

Post by nickolay »

Hi,

This code is not syntactically correct. You can't place assignment inside the function call.

Sorry, correcting syntax errors is out of the scope of this forum. Please refer to the online JavaScript learning materials.
We offer training in both Ext JS and our products, read more here.
Read the API documentation

User avatar
vakhsakhalyan
Posts: 9
Joined: Mon Apr 09, 2018 4:10 pm

Re: TypeError: Cannot read property 'document' of null oncli

Post by vakhsakhalyan »

Yes, Sorry I have updated the code. But the error is become from siesta-all.js

User avatar
nickolay
Core Developer
Core Developer
Posts: 3450
Joined: Mon May 16, 2011 10:48 am

Re: TypeError: Cannot read property 'document' of null oncli

Post by nickolay »

You don't need to make component query separately - Siesta supports it as target locator. See https://www.bryntum.com/docs/siesta/#!/ ... tionTarget for details.

So the code you posted (it has unknown variable "callback" btw) can be simplified just to:

Code: Select all

t.chain(
    { click : '>>#login' }
)
Its not enough information to help you, please provide more details or a reproducible test case.
We offer training in both Ext JS and our products, read more here.
Read the API documentation

Post Reply