Forum Discussion
AlexKaras
12 years agoCommunity Hero
Hi Ian,
> We are also seeing nulls occasionaly coming back from QuerySelector [...]
There has been discussion about this some time ago (don't have its URL at hand at the moment), but in a nutshell:
-- TestComplete waits until the page is obtained from the server, but has no idea about scripts that can possible be executed later by the browser and change the structure of the page;
-- Considering the above, for the dynamic pages, you can rely on the result of the functions that search for an object only if you are sure that object must either exist or not at this moment of time;
-- Otherwise, if the object may or may not yet be created dynamically by the script (and this depends on the browser load, script performance, network performance to provide data for the additional async. requests, etc.), you must either use WaitXXX() functions that wait for the object within certain timeout (e.g. WaitPanel(), WaitButton(), etc.) or implement a loop in the code and wait until the needed object is not returned by the QuerySelector or similar function.
> We are also seeing nulls occasionaly coming back from QuerySelector [...]
There has been discussion about this some time ago (don't have its URL at hand at the moment), but in a nutshell:
-- TestComplete waits until the page is obtained from the server, but has no idea about scripts that can possible be executed later by the browser and change the structure of the page;
-- Considering the above, for the dynamic pages, you can rely on the result of the functions that search for an object only if you are sure that object must either exist or not at this moment of time;
-- Otherwise, if the object may or may not yet be created dynamically by the script (and this depends on the browser load, script performance, network performance to provide data for the additional async. requests, etc.), you must either use WaitXXX() functions that wait for the object within certain timeout (e.g. WaitPanel(), WaitButton(), etc.) or implement a loop in the code and wait until the needed object is not returned by the QuerySelector or similar function.