This is a migrated thread and some comments may be shown as answers.

Unable to click on sub-menu items

2 Answers 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Giri
Top achievements
Rank 1
Giri asked on 12 Dec 2012, 03:55 AM
Hi,
I am trying to automate an sharepoint web application using telerik testing framework. I was succesful in most of the identificcation and user actions except below problem.

The site has Menu > Sub menu where the 'sign in as different user' option is available.
When the page initially loads only the menu item will be displayed, only after clicking this menu, the sub menu will be dislayed in the page.
(I am sure this is not ajax)

I am able to identify the sub menu (by ActiveBrowser.RefreshDomTree()) after clicking the menu but when trying to click on the sub menu it fails.
HtmlAnchor SLnk = Find.ById<HtmlAnchor>("zz5_Menu");
           SLnk.MouseHover(5,5);
           SLnk.MouseClick(MouseClickType.LeftClick);
               
           ActiveBrowser.RefreshDomTree();
           var dUser = Find.ByAttributes<HtmlControl>("description=Login With a different account.", "text=Sign in as Different User");
                    
 
           Console.WriteLine(dUser.IsEnabled + "  " + dUser.IsVisible());
           dUser.MouseClick();

The IsEnabled returns "true" and IsVisible returns "false".
Even after successfully identifying the sub menu control (dUser), any mouse actions are not working on the control.

I also tried:

dUser.MouseHover();

dUser.ScrollToVisible();

before clicking the sub menu.
(attached the sub menu html code taken in firebug)
Please help.

Thanks in advance.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Stoich
Telerik team
answered on 15 Dec 2012, 10:26 AM
Hi Giri,
it's going to be hard to pinpoint the exact reason for the problem without seeing the test run.

Is your application publicly accessible? If so the best thing would be for me to run your code against your application and observer how it behaves and why the click isn't going through.

If the application is not accessible you can record a video that shows how the code runs against it - perhaps we can see clue as so what the code is not working.

One thing you could try is to add code that waits for the element that you're trying to click to exist on the page:
http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/wait-for-element-to-exist-in-code.aspx

You can also try adding a fixed delay between the click that is supposed to make the new button appear and the code that is supposed to click it. The code for a fixed delay is very simple:
System.Threading.Thread.Sleep(5000);
The above could would introduce a fixed delay of 5 seconds.

It's unclear whether this would actually help. I could find no obvious problems with your code so the bottom line is that we'll probably need some additional info in order to resolve this.

Hope to hear from you soon.

All the best,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Giri
Top achievements
Rank 1
answered on 16 Jan 2013, 06:30 PM
Thanks for solving this problem in GoTo meeting.
The solution is to get the inner HTMLSpan control inside TD tag and and perform click action on it.
Tags
General Discussions
Asked by
Giri
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Giri
Top achievements
Rank 1
Share this question
or