Select control not popping up message when listitem is click

Ask general questions here.
User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Select control not popping up message when listitem is click

Post by Support Team » Mon Jul 23, 2012 10:46 am

Hi,

Now I got you. That's right, executeScript blocks all your apps until it is finished. The problem here is that Ranorex can't close the messageBox since it is blocked too.

The solution is the following:
webDocu.ExecuteScript("window.setTimeout(function() { alert('MyMessageBox'); }, 10);");
Button buttonOK = "/form[@title='Message from webpage']/button[@text='OK']";
buttonOK.Click();
Now your function to be executed is the setTimeout (which is in this case finished in 10 ms). After this, the message box is popping up and you can go on as usual.

Hope it will work now.

Regards,
Larissa
Ranorex Support Team
.
Image

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: Select control not popping up message when listitem is click

Post by Aracknid » Mon Jul 23, 2012 3:52 pm

Don't know if this got lost in the thread, but I also needed to know if there is a way I can programmatically find out if there is an event that needs to be fired.

For example, I have the Select control as a Ranorex object 'MySelect'. Is there a way I can tell that MySelect has an onchange value?

Thanks,

Aracknid.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Select control not popping up message when listitem is click

Post by Support Team » Tue Jul 24, 2012 9:56 am

Hi,

What you can do is the following:
To find out if a select has got an onchange event you need to see the html-code. E.g. via
String htmlCode = selectTag.Parent.GetInnerHtml();
or via
String htmlCode = selectTag.Element.GetAttributeValueText("onchange").ToString();
Kind Regards
Larissa
Ranorex Support Team
.
Image

Kumar
Posts: 24
Joined: Fri Aug 03, 2012 12:12 pm

Re: Select control not popping up message when listitem is click

Post by Kumar » Sat Aug 04, 2012 1:07 pm

Hi,

I has similar problem, after going through this post now i am able to fix it.

Thanks for all the those who have posted. :)

Kumar.

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Select control not popping up message when listitem is click

Post by omayer » Mon Sep 10, 2012 5:29 pm

how do i tell which javascript to execute , webDocument.ExecuteScript("The java script code chunk"); also do i have to define WebDocument webDocument = "/[email protected]="asdfsdf.com", Thank you in advance
Tipu

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Select control not popping up message when listitem is click

Post by Support Team » Tue Sep 11, 2012 9:53 am

Hi,

Yes you have to define a WebDocument. After this you call your java script. For example an alert:
webDocu.ExecuteScript("window.setTimeout(function() { alert('MyJavaScript Pop Up'); }, 10);");
Instead of the alert function you put your java script function you want to have executed.

Kind Regards,
Larissa
Ranorex Support Team
.
Image