Selecting the ListBox Value after a Refresh of a WebPage

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Selecting the ListBox Value after a Refresh of a WebPage

Post by dal » Mon Sep 27, 2010 2:13 pm

Hi Team,

I have 3 different list boxes in my WebPage, after the selection of the any item in the First ListBox the WebPage will refresh, then will populate the appropriate data into the other 2 ListBoxes.

Here my issue is after the selection of the first ListBox, the second ListBox is not been clicked for the selection of any item under it.

I have used the following code...

repo.LstBox1.Click
LibraryFunctions.ListBoxValueSelect("Item1") 'Method to select the appropriate used defined data

repo.LstBox2.EnsureVisible ' Have used repo.LstBox2.Focus - also - but no use not working
repo.LstBox2.Click
LibraryFunctions.ListBoxValueSelect("Item1")

repo.LstBox3.EnsureVisible
repo.LstBox3.Click
LibraryFunctions.ListBoxValueSelect("Item1")

Have observed the cursor is moved to Top Left end cornor of the WebPage after the selection of the first ListBox item.

Any suggestions...Plz..

Regards,
Dal...

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

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by Support Team » Mon Sep 27, 2010 2:28 pm

Hi,

Have you tried to use a delay between your actions, maybe your script is to fast and therefore Ranorex clicks to the top-left of your screen.

Regards,
Peter
Ranorex Team
.
Image

dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by dal » Mon Sep 27, 2010 4:45 pm

Yes Peter.. I tried by giving the delay upto 10 secs...

The refreshed page was displayed in 5 secs time...

If I click the object manually after the page refresh, its able to select the Item which I want to select from the list. But I don't want give a try manually since we might plan un-attended execution once the complete packages are developed.

Regards,
Dal...

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

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by Support Team » Tue Sep 28, 2010 10:18 am

Hi,

Would it be possible to send us a tiny sample application with the same issue? And maybe your code you try to execute. Because I tried to reproduce this issue but I had no success.

Thanks in advance.

Regards,
Peter
Ranorex Team
.
Image

dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by dal » Wed Sep 29, 2010 3:14 pm

Hi Peter,

I tried the possible way I can think of, but I had no success.

Is that possible to connect through WebEx / Net Meeting to analyse the issue tomorrow (09/30), and based on your suggestions we will take it forward.


Regards,
Dal...

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

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by Support Team » Thu Sep 30, 2010 10:20 am

Hi,

Please check the RxPath of the second list-box, after you refresh your page, maybe the RxPath is not the same and therefore Ranorex clicks to the top left. Please try also to disable the folder caching of your repository items. Therefore please take a look to following page http://www.ranorex.com/support/user-gui ... html#c2076

Regards,
Peter
Ranorex Team
.
Image

dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by dal » Thu Sep 30, 2010 11:02 am

Hi Team,

Thanks for the info...
I have checked the second list-box's RxPath as well, its still the same as it was.
I found a solution in other way, by giving the Delay.speedfactor = 1.0, (which is the default) ...

For finding the solution for script play-back speed up this was set to 0 instead of the default value.

The Code Sample as below:

Keyboard.DefaultKeyPressTime = 0
Mouse.DefaultClickTime = 0
Mouse.DefaultMoveTime = 0
Delay.SpeedFactor = 1.0

repo.LstBox1.Click
LibraryFunctions.ListBoxValueSelect("Item1")
Delay.Seconds(10)

repo.LstBox2.Click
LibraryFunctions.ListBoxValueSelect("Item1")

repo.LstBox3.Click
LibraryFunctions.ListBoxValueSelect("Item1")

But I do have a question here is there a way to suppress Delay.Seconds(10) in my code... I just tried with the following ... but it didn't wait...for the existance and executed the code ---- repo.LstBox2.Click ---- immediately

If repo.LstBox2Info.Exists Then
repo.LstBox2.Click
LibraryFunctions.ListBoxValueSelect("Item1")
End If

Any suggestions...

Appreciate all your help on the questions I have raised on this "Lively" Forum

Regards,
Dal...

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

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by Support Team » Thu Sep 30, 2010 2:34 pm

Hi dal,

With your code:
If repo.LstBox2Info.Exists Then
repo.LstBox2.Click
LibraryFunctions.ListBoxValueSelect("Item1")
End If
Ranorex will not wait because you have set not delay inside your if statement. If you set a Delay after the if statement Ranorex should wait for the expected time you set.

Regards,
Peter
Ranorex Team
.
Image

dal
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by dal » Thu Sep 30, 2010 5:48 pm

Hi Peter,

I agree with you, but my question is little different, after the page refresh, can't I wait for second ListBox object to be appeared on the web page before performing any action to it. Like typical WaitForExistance, without specifying the hard-coded delay as Delay.Seconds(10).

The following one won't perform WaitForExistance operation? :

Code: Select all

If repo.LstBox2Info.Exists Then
End If
I thought it will wait for the object until Search Timeout (say max of 10s) for that object and perform an action on it. But if the object displayed in less than 10s also it will perform the action on it immediately, as this is not a hard-coded wait

Kindly suggest...

Regards,
Dal...

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by Ciege » Thu Sep 30, 2010 10:35 pm

Try doing a while loop that waits until the object exists...
I.e.
While repo.LstBox2Info.Exists == false
wait
Loop
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Selecting the ListBox Value after a Refresh of a WebPage

Post by Support Team » Fri Oct 01, 2010 8:39 am

Hi,

I would also suggest you the solution of Ciege, or use following method.
public static void WaitForExistance(TimeSpan timeout)
{
    System.DateTime abortTime = System.DateTime.Now + timeout;
    while (!repo.yourItemInfo.Exists())
    {
        if (System.DateTime.Now > abortTime)
            throw new RanorexException("Timeout reached for your Element");
    }
}
and overload the method as follow
WaitForExistance(new TimeSpan(0, 0, 10));
This method will wait for your element and abort if the timeout is reached.

Regards,
Peter
Ranorex Team
.
Image