cancel
Showing results for 
Search instead for 
Did you mean: 

pop up window how to ignore

SOLVED
Frequent Contributor

pop up window how to ignore

Hi, 

I am having an issue and asking for help Smiley Sad

I have keyword testcases running on a particular website with no problem.

However business implemented redcently a pop up that randomly shows up on a home page which blocks the page and brakes the test cases.

 

The only way to get rid of that is by clicking "no thanks" on a pop up.

 

Is there a way i can record a keyword test case that lets says "if" the pop up present- hit "no thank you "else"- ignore.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: pop up window how to ignore

You don't have to do it via scripting if you're not comfortable with it. 

 

https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html

 

That provides step by step instructions on how to accomplish the same thing in a keyword test. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
8 REPLIES 8
Community Hero

Re: pop up window how to ignore

You definitely can do this by checking the existance of the object.

 

Basically it would come down to 

 

 

if (Object.Exists) {
  Object.Button.Click()
}
else {
  Log.Message("Popup Does Not Exist.")
} 

Check here for how to accomplish this with a keyword test. 

https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html

 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Community Hero

Re: pop up window how to ignore

Hi,

 

If you know when this pop-up can be displayed, than Carson's suggestion is the way to go.

If the pop-up can be displayed unpredictably (e.g. by timer, some randomizer, etc.) then you may consider one of the OnXXX events of TestComplete (e.g. OnUnexpectedWindow, OnOverlappedWindow, etc., the exact event to use depends on the design and behaviour of the tested web page.) and implement the similar code that will check if pop-up is displayed and close it.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Frequent Contributor

Re: pop up window how to ignore

Thank you! 

So here is what I did. 

I recorded the test and clicked on the "no thank you button" to get the object name.

then I created a script and added it to the keyword test right before the moment when the pop up sometimes pop ups.

 

here is the script:

 

function Test()
{
if (Object.Exists) {
Object.Button.Click(Aliases.browser.pageStagingConsolidatedcreditKin.panelBxCampaign.panel.panel.panelBxCreative.panel.panelBxStep1.formBxFormStep1.buttonNoThanksIMJustLookingForNo)
}
else {
Log.Message("Popup Does Not Exist.")
} }

 

What could be wrong?

it runs fine when the pop up is not there and the report gives me a message that pop up does not exist, but the times when it does pops up TC does not click on no thank you button.

Community Hero

Re: pop up window how to ignore

Take your recorded test and use the Convert To Script function to double check the syntax where you clicked on the button.

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/converting-script.html

Community Hero

Re: pop up window how to ignore

What I provided was pseudo code not exactly what you should be using.

 

You need to check if YOUR object exists, not just Object. Think about it this way, in your provided code what is Object? It's not defined to be anything, so there would never be an Exists == true in it.

 

Then you need to call the click method on your button, not Object.Click(<yourButton>). Click is a method provided by Test Complete for all on screen objects. 

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/onscreen/click-action...

 

I also have a feeling you might end up with problems with that record and play back because your using the automatic name mapping with a lot of objects that you don't actually interact with in your Aliases. 

 

Definitely reccomend reading through all of the documentation about name mapping here: https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/inde...

 

Relying just on the auto generated object mapping is setting yourself up for some major headaches in the future. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Frequent Contributor

Re: pop up window how to ignore

I see what you mean, Im not really good with scripting, but understand your logic.

I think I figured how to do the "click object", 

but how do I define the object?

Community Hero

Re: pop up window how to ignore

You don't have to do it via scripting if you're not comfortable with it. 

 

https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html

 

That provides step by step instructions on how to accomplish the same thing in a keyword test. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Frequent Contributor

Re: pop up window how to ignore

Thank you, I was able to figure this out with keyword test

New Here?
Join us and watch the welcome video:
Top Kudoed Authors