cancel
Showing results for 
Search instead for 
Did you mean: 

Window is invisible and thus cannot be activated

SOLVED
Community Hero

Window is invisible and thus cannot be activated

Morning all.  First up, the error:

WindowISInvisible.JPG

  I put text into a textbox in script.  In the Picture you can see that the page is just fine with nothing in the way.  I have extensive code to do existance checks etc. before I even get here, so I'm pretty sure that I have the object.  Code (roughly) about as follows

 

function SetTex(TextBoxControl) //Textboxcontrol is a table  The textbox is inside this table - DevX
{
var textContainer = null;
if(aqObject.IsSupported(TextBoxControl,"ObjectType")) //You never know...
	{
		if(aqObject.GetPropertyValue(TextBoxControl,"ObjectType")== "Table") //we got the outer table.  Execute waits
		{
			var waitCell = ExecuteWait("CELL",TextBoxControl,[0,0]);	//helper function that just does a WaitNNN - helps ensure everything is ready		
			textContainer = waitCell.FindChildEx("ObjectType",objectType,1,true,5000);	
		}
		else //We probably got the textbox itself as mapped object.  Do a FindEx rather than findchildex
		{
			textContainer = TextBoxControl.FindEx("ObjectType",objectType,1,true,5000);		
		}
	}
	else //most likely the object doesn't exist
	{
		Log.Error("Mapped TextBox object does not have a valid object type.","",pmNormal,"",GetPagePicture());
		return;
	}
}
if(!textContainer.WaitProperty('Exists', true, 5000))
	{
		Log.Error("Unable to locate text container in textbox control [" + TextBoxControl.MappedName + "] in the allocated time","",pmNormal,GetPagePicture());
		return;	
	}	
  
	if(!textContainer.WaitProperty('Visible', true, 5000))
	{
		Log.Error("Text container in textbox control [" + TextBoxControl.MappedName + "] is not visible","",pmNormal,GetPagePicture());
		return;	
	}		

textContainer.SetText("");
}

If we reach the SetText, the texbox both exists and is visible, but then I get the error. Not always, mind you. And the next thing it does is set the text as expected. The test continues correctly, but it fails because of this error. Thoughts?


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Hero

Re: Window is invisible and thus cannot be activated

Bah !  I think I know what it is !

 

There's this post, written by me, not to long ago on a Smartbear Functional Web Testing board near you ! It explains that DevX has a quirk with setting text.  SetText() is unreliable - TestComplete can't alway find it and DevX doesn't register changes.  .Keys() however works fine...

 

There's no facepalm emoticon..

 

Quick, someone repost my post so I can mark it as the accepted solution.  I can't mark my own answer as a solution if I was just being a bit slow Smiley Tongue


-------------------------------------------------
Standard syntax disclaimers apply
Regards,

View solution in original post

Community Hero

Re: Window is invisible and thus cannot be activated

Hi,

 

> SetText() is unreliable [...]

Not that it is unreliable... It just works differently when compared to .Keys().

.SetText() tries direct assignment to the property that keeps the value of the given object. This should work much faster than .Keys(), but the problem is that a lot of controls do not process direct property assignment but expect the value to be modified via either keypresses or be pasted from the clipboard.

On the contrary, .Keys() method puts key press messages into the control's message queue. Exactly like the OS does when end-user types on the keyboard. Then control's message routine extracts and processes keycodes (and all other codes like mouse events etc.) from the queue and either processes them or relays to the parent message queue. This process is obviously slower but corresponds to the regular developers' expectations.

 

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

3 REPLIES 3
Community Hero

Re: Window is invisible and thus cannot be activated

Bah !  I think I know what it is !

 

There's this post, written by me, not to long ago on a Smartbear Functional Web Testing board near you ! It explains that DevX has a quirk with setting text.  SetText() is unreliable - TestComplete can't alway find it and DevX doesn't register changes.  .Keys() however works fine...

 

There's no facepalm emoticon..

 

Quick, someone repost my post so I can mark it as the accepted solution.  I can't mark my own answer as a solution if I was just being a bit slow Smiley Tongue


-------------------------------------------------
Standard syntax disclaimers apply
Regards,

View solution in original post

Community Hero

Re: Window is invisible and thus cannot be activated

Hi,

 

> SetText() is unreliable [...]

Not that it is unreliable... It just works differently when compared to .Keys().

.SetText() tries direct assignment to the property that keeps the value of the given object. This should work much faster than .Keys(), but the problem is that a lot of controls do not process direct property assignment but expect the value to be modified via either keypresses or be pasted from the clipboard.

On the contrary, .Keys() method puts key press messages into the control's message queue. Exactly like the OS does when end-user types on the keyboard. Then control's message routine extracts and processes keycodes (and all other codes like mouse events etc.) from the queue and either processes them or relays to the parent message queue. This process is obviously slower but corresponds to the regular developers' expectations.

 

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Community Hero

Re: Window is invisible and thus cannot be activated


a lot of controls do not process direct property assignment but expect the value to be modified via either keypresses or pasting from the clipboard.

 


Absolutely the case with DevX


-------------------------------------------------
Standard syntax disclaimers apply
Regards,
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors