Attempted Mouse click causes move to top left corner

Class library usage, coding and language questions.
markvanraalte
Posts: 13
Joined: Thu Apr 15, 2010 4:34 pm

Attempted Mouse click causes move to top left corner

Post by markvanraalte » Thu Apr 29, 2010 8:14 am

Hi,

I am testing a web application (with Ranorex C#) and at one point I need to confirm a dialog alert by clicking on the OK button.

I simply perform the click method on the OK button using:

repo.WebDocumentName.GenericTicketDialog.CloseButton.Click() he name of the button I have taken from the repository.
Sometimes this works fine but sometimes (intermittantly) it fails to click() on the button and moves to the top left corner of the web application. Is there a work around?
Should I test to see if the button exists?

I've tried:
if ( repo.WebDocument.GenericTicketDialog.CloseButtonInfo.Exists())

But that always seems to return true.

How can I fix this?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Attempted Mouse click causes move to top left corner

Post by Support Team » Thu Apr 29, 2010 3:12 pm

Hi!

In extreme exceptions it can be possible that the item is valid and short after the item gets the state invalid, but that happens almost never.
markvanraalte wrote:I've tried:
if ( repo.WebDocument.GenericTicketDialog.CloseButtonInfo.Exists())
But that always seems to return true.
Can it be possible that this dialog always exists on your webpage (only set from visible to invisble and vice versa) and it's not generated by an action.
Please copy the path of the element from repository and paste it to SPY so you can check if the element always exists (Dialog should not be visible). This can be a possible solution why you always get true of method Exists().

BTW, I've also tried it with a Dialog in some webpage and the Exists() worked as expected.
Visible -> Exists = true
Not Visible -> Exists = false

Regards,
Peter
Ranorex Support Team