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

impossible to click on element in RichFaces tree

9 Answers 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Anton
Top achievements
Rank 1
Anton asked on 04 Oct 2012, 02:00 PM

Hello.

Our product hardly used RichFaces elements but WebAii cannot click on them.

for example (more important problem): Webaii can find node in RichFacess tree but it can't click on natively. Just nothing happens.

I can click with .MouseClick(MouseClickType.LeftDoubleClick) but it works only sometimes.

9 Answers, 1 is accepted

Sort by
0
Byron
Telerik team
answered on 09 Oct 2012, 04:49 PM
Hi Anton,

So far, I have not been able to reproduce this behavior: the Click() method works for me against all switch types on the Rich Tree Live Demo. In order to help with your issue, we need more information about your test scenario. Please provide us with a copy of your test and access to your application. If it is not possible to grant us access to your application, please take a Fiddler trace and attach it to a support ticket in a zip file. If you are unfamiliar with how to do that please refer to this short video. You can download the Fiddler application from here. A Jing video demonstrating the issue may also help us to better understand what is happening. Thanks for providing the information we need to best advise you.

Greetings,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stoich
Telerik team
answered on 09 Oct 2012, 05:12 PM
Hi Anton,

I would like to interject here:
are you familiar with the concept of a Simulated VS a Regular click? Check out the following article:
http://www.telerik.com/automated-testing-tools/blog/12-09-04/regular-vs-simulated-clicks.aspx

That article is about Test Studio but the exact same concept applies to the Testing Framework. The Click() method is a regular, non-simulated click that doesn't fire events attached to controls. That might explain why it's not working for you. MouseClick() on the other hand is a simulated click and that's why it's working out probably. What we need to determine is why it's not working 100% of the time so go ahead and provide the info requested by Byron.

Greetings,
Stoich
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Anton
Top achievements
Rank 1
answered on 10 Oct 2012, 11:21 AM

Hi Stoich and Byron.

Byron, as i can see you are using an old version of rich:tree. Please look at RichFaces tree demo. There is 4.2.2 version but we are using 4.0.0. But i think there is no a lot of differences.

So if you can't reproduce issue on this demo, you can try to download our application from here. You should download "WebStudio (war)" file and deploy it under tomcat. After deploying create new project in repository and try to click on files of project in "Navigator tree" (Expand "Projects" node -> expand project -> click on "rulex.xls").

Stoich, i know difference and i also try this code but it works only in FireFox:

var el = Find.ByXPath<HtmlSpan>(
                    String.Format(
                        "/html/body/form/div[2]/div/span[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/div/span/span/span[text()='{0}']/..",
                        "rules.xlsx"));
                el.ScrollToVisible(ScrollToVisibleType.ElementTopAtWindowTop);
                el.Click();
                el.InvokeEvent(ScriptEventType.OnMouseDown);
                el.InvokeEvent(ScriptEventType.OnMouseUp);

I use FireBug to know which events fired.

To reproduce the problem run this test:

[Test]
        public void asdasdasD()
        {
            var NewProjectName = "asdd12345";
            ActiveBrowser.NavigateTo(YourUrlHere);
            Find.ByExpression<HtmlAnchor>("id=ll", "|", "tagindex=a:1").Click();
            ActiveBrowser.WaitForElement(new HtmlFindExpression("id=nodeView"),
                                         60000, false);
            Assert.AreEqual("Projects",
                            Find.ById<HtmlSpan>("nodeView").Find.ByExpression<HtmlDiv>("class=view_header").
                                InnerText);
            ActiveBrowser.WaitForElement(new HtmlFindExpression("id=tree"),
                                         60000, false);
            Find.ByExpression<HtmlAnchor>("class=button-primary").Click();
            Assert.IsTrue(Find.ByExpression<HtmlDiv>("id=modalNewProject_container").IsVisible(),
                          "New Project Popup doesn't appeared.");
  
            Find.ById<HtmlInputText>("createProjectFormTempl:projectName").Text = NewProjectName;
            Find.ById<HtmlInputSubmit>("createProjectFormTempl:sbtTemplates").Click();
            Assert.AreEqual("success",
                            Find.ByExpression<HtmlListItem>("class=messages", "|", "tagname=li").CssClass,
                            "Successfully message doesn't appeared.");
              
  
            Find.ByXPath<HtmlSpan>(
                            "/html/body/form/div[2]/div/span[2]/div/div[2]/div/div/div[2]/div/div/div[1]/div[1]/span[1]").Click();
  
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAjax(60000);
            ActiveBrowser.RefreshDomTree();
  
            Find.ByXPath<HtmlDiv>("/html/body/form/div[2]/div/span[2]/div/div[2]/div/div/div[2]/div/div/div[1]").Wait.
                ForAttributes(Configuration.Instance.AjaxUpdateTimeOut, "class=~rf-tr-nd-exp");
  
            Find.ByXPath<HtmlSpan>(
                            String.Format(
                                "/html/body/form/div[2]/div/span[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/span[2]/span/span[text()[contains(.,'{0}')]]/../../../span[1]",
                                NewProjectName)).ScrollToVisible(ScrollToVisibleType.ElementTopAtWindowTop);
  
            Find.ByXPath<HtmlSpan>(
                            String.Format(
                                "/html/body/form/div[2]/div/span[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/span[2]/span/span[text()[contains(.,'{0}')]]/../../../span[1]",
                                NewProjectName)).Click();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.WaitForAjax(60000);
            ActiveBrowser.RefreshDomTree();
  
            var el = Find.ByXPath<HtmlSpan>(
                               String.Format(
                                   "/html/body/form/div[2]/div/span[2]/div/div[2]/div/div/div[2]/div/div/div/div/div/div/span/span/span[text()='{0}']/../span",
                                   "rules.xls"));
            el.Click();
            //el.MouseClick(MouseClickType.LeftClick);
            //el.MouseClick(MouseClickType.LeftClick);
            //el.MouseClick(MouseClickType.LeftDoubleClick);
            ActiveBrowser.WaitForElement(new HtmlFindExpression("id=deleteFileId"),
                                         10000, false);
              
        }

0
Byron
Telerik team
answered on 15 Oct 2012, 04:18 PM
Hello Anton,

Thanks for providing access to your application and sample test. Using the new RichFaces demo, it does appear that a regular Click() action does not work. MouseClick() works as expected in Firefox, but in other browsers there is sometimes a delay of several seconds before the click takes effect. Regarding your first code sample: do you mean that you have tried this code sample as is, and it only works in Firefox? This first code sample only uses the Click() method. Also, have you tried using a MouseClick() that specifies click coordinates? For example, this line of code is consistently clicking against the RichFaces tree, albeit with some delay:

Pages.RichFacesShowcase.SampleSpan.Wait.ForExists(10000);
Pages.RichFacesShowcase.SampleSpan.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementTopAtWindowTop);
Pages.RichFacesShowcase.SampleSpan.MouseClick(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 0, 0, ArtOfTest.Common.OffsetReference.AbsoluteCenter);

All the best,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Anton
Top achievements
Rank 1
answered on 15 Oct 2012, 05:44 PM

Hello Byron,

Thanks for reply.

according to your questions:

" Regarding your first code sample: do you mean that you have tried this code sample as is, and it only works in Firefox?" - Yes, I try this cad as is and it work only in FireFox  (version 15). In IE9 x32 on Win7 x64 it doesn't work.

" This first code sample only uses the Click() method" - Why? I also invoke OnMouseDown and OnMouseUp events. without them code doesn't work.

"Also, have you tried using a MouseClick() that specifies click coordinates?" - Yes, I try this with many variations and it work but not for all time.

And the most important that i can't use MouseClick method because of it doesn't work on CI and RDP (VNC) sessions.

0
Byron
Telerik team
answered on 18 Oct 2012, 05:24 PM
Hi Anton,

Closer investigation indicates that the only method currently available for automating a click against a rich:tree node is the MouseClick() method. You may be able to execute desktop commands via RDP or CI build using one of these workarounds. Also, please let us know if there is a pattern or scenario in which the MouseClick() method is not working correctly so we can take a closer look.

Kind regards,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Anton
Top achievements
Rank 1
answered on 19 Oct 2012, 07:52 AM

Hi Byron,

I read this article few weeks ago and it doesn't helped me.

i tried to run tests via manual run from gallio via RDP.

when i press "Start" button i run 'cmd' file which keep session active and logoff me.

cmd file: 

tscon.exe RDP-Tcp#2 /dest:console

with this cmd, tests run more stable but not enough. When i connect to this pc i see that test try to click button (via MouseClick) but miss it (30-50 px upper) and other tests with MouseClick sometimes failed sometimes passed.

I can give you full tests solution.

0
Accepted
Byron
Telerik team
answered on 23 Oct 2012, 10:39 PM
Hello Anton,

I'm sorry the workarounds are not working for you. Because the limitations of desktop methods over RDP are inherent in desktop automation, we have not found reliable workarounds for this problem. You may consider contacting the control vendor for guidance on automating without desktop clicks.

Regards,
Byron
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Anton
Top achievements
Rank 1
answered on 24 Oct 2012, 09:57 AM

Hello Byron and Stoich,

Thanks for help and investigation of problem.

I think we should to develop custom control, because of RichFaces a lot of buggy =)

Tags
General Discussions
Asked by
Anton
Top achievements
Rank 1
Answers by
Byron
Telerik team
Stoich
Telerik team
Anton
Top achievements
Rank 1
Share this question
or