1 2 Previous Next 17 Replies Latest reply: Dec 4, 2008 12:35 PM by 10129 RSS

    Selenium to test ADF UI Application

    41478
      I've created an ADF UI application and am running it from within JDeveloper.
      My default browser is Firefox 2.x.
      I've installed Selenium IDE and am recording my UI interactions using it.
      When I playback what I've recorded, Selenium is not able to find an ADF component (command link) that it found earlier.
      And I get the following error on the Selenium Server:
      Got result: ERROR: Element mainView:regionHouston:j_id___jsp_tag_ctru3i3:0_3:populateGridLink not found on session 316687.

      Any help is appreciated.

      Thanks
      Ramesh
        • 1. Re: Selenium to test ADF UI Application
          436787
          Are you using the testId attribute? Use that for your tests if you are not.

          --Ric                                                                                                                                                                           
          • 2. Re: Selenium to test ADF UI Application
            41478
            Hi Ric,

            Could you please explain this a bit more? I don't know what the testId attribute means?

            Thanks
            Ramesh
            • 3. Re: Selenium to test ADF UI Application
              436787
              The testId was created as an id that can be used for testing purposes. To use testing tools with faces you need a pre-determined id to test against. However, id's create by humans are generally longer than those automatically generated by the server creating larger payloads that need to be delivered to the client and larger string buffers on the server. This is where the testid comes in. You can add a human readable id to the components within your view and configure the application to deliver the testid or auto generated id. To configure the runtime you simply need to set 'oracle.adf.view.rich.automation.ENABLED' to true in web.xml. You can configure JDeveloper to auto generate testids for you by going to your project properties, selecting ADF Vew Settings and checking the auto generated box.

              Thanks,
              Ric
              • 4. Re: Selenium to test ADF UI Application
                41478
                Hi Ric,

                These are the entries in my jsff fragment file:
                <af:commandLink rendered="#{node.children eq null}"
                text="#{node.text}"
                inlineStyle="color:#FF8000;font-weight:bold;"
                id="populateGridLink"
                action="#{ResultsBean.showFullGrid}">

                When I run my client and record it using Selenium IDE, these are the steps recorded:

                selenium.open("/MonteCarlo-ViewController-context-root/faces/MonteCarlo.jsp");
                selenium.click("mainView:regionHouston:j_id___jsp_tag_ctru3i3:0_3:populateGridLink");
                selenium.waitForPageToLoad("30000");

                I'm running my application on Firefox. When I view the page source for the application I'm running, I don't see any entry in there for the af:command link (namely populateGridLink) that I've used above.

                Also, when I play back the Selenium recording, it is not able to find that command link
                either. And the UI execution halts at that point.

                But everything works fine if I simply run my ADF application without any testing tool.

                Any help with this would be very much helpful.

                Thanks
                Ramesh
                • 5. Re: Selenium to test ADF UI Application
                  436787
                  ow007631,

                  Let's try something. Can you set clientComponent="true" on the offending component and see if that fixes the problem? Also, you need an id or testId for every component as id's generated by the server are not guaranteed to be the same.

                  --Ric                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                  • 6. Re: Selenium to test ADF UI Application
                    41478
                    Ric,

                    The af:command link is used within a jsf fragment.
                    The id for that is populateGridLink.
                    I've now set the property clientComponent="true" for this adf component.
                    Also, I've enabled the property to automatically generate testId attributes under Project Properties > ADF View Settings.

                    I rebuilt the application within JDeveloper.
                    I don't see any difference yet.

                    1. How would the above commandLink component show up when I view the Page Source?
                    2. Where would the testId attribute be displayed?
                    3. Should I by any chance clear the browser cache before re-running the application inorder for these changes to show up?

                    Thanks
                    Ramesh
                    • 7. Re: Selenium to test ADF UI Application
                      436787
                      Don't forget this step:

                      "To configure the runtime you simply need to set 'oracle.adf.view.rich.automation.ENABLED' to true in web.xml."

                      Also, clear the browser cache and at runtime the id of the component will be the testId you set.
                      • 8. Re: Selenium to test ADF UI Application
                        41478
                        Ric,

                        Added the following entries to web.xml in \ViewController\public_html\WEB-INF directory.

                        <context-param>
                        <param-name>oracle.adf.view.rich.automation.ENABLED</param-name>
                        <param-value>true</param-value>
                        </context-param>

                        I don't see the id of the component when I view the page source.

                        Have I added the entries correctly? If so, what else could be the problem.

                        For the command link that I'm interested in, the page source only shows id="mainView:regionHouston:j_id___jsp_tag_ctru3i3" whereas Selenium looks for an entry id="mainView:regionHouston:j_id___jsp_tag_ctru3i3:0_3:populateGridLink".

                        Thanks
                        Ramesh
                        • 9. Re: Selenium to test ADF UI Application
                          436787
                          Do you have the testId set for each component? This will be the value delivered to the client.

                          --Ric                                                                                                                                                                                                               
                          • 10. Re: Selenium to test ADF UI Application
                            41478
                            Ric,

                            I've the testId attribute set for the component I'm interested in.
                            I've enabled the Auto Generate testId attribute option.
                            I've modified the web.xml to include the lines you mentioned above.
                            I've cleared my browser cache.
                            Rebuilt the application within JDeveloper.

                            But still I'm not able to see my ADF component with the id in my Page source. The component is there but without either the id or the testId attribute(s). Hence Selenium is not able to locate that component when it plays back the test and is not able to move to the next step.

                            Could there be a problem with the JDeveloper version that I have. I've the JDeveloper Studio Version 11.1.1.0.0 Build JDEVADF_MAIN.1JAVA_GENERIC_070504.2249.4524.

                            My JSFF entries:

                            <af:commandLink rendered="#{node.children eq null}"
                            text="#{node.text}"
                            inlineStyle="color:#FF8000;font-weight:bold;"
                            id="populateGridLink"
                            testId="populateGridLink"
                            action="#{ResultsBean.showFullGrid}"
                            clientComponent="true">
                            <af:clientAttribute name="gridaction" value="Populate Grid"/>
                            af:attributeDragSource attribute="gridaction"/>
                            </af:commandLink>

                            My web.xml entries:


                            <context-param>
                            <param-name>oracle.adf.view.rich.automation.ENABLED</param-name>
                            <param-value>true</param-value>
                            </context-param>

                            Thanks
                            Ramesh
                            • 11. Re: Selenium to test ADF UI Application
                              41478
                              Ric,

                              Is this the right way to add this property to web.xml?

                              <context-param>
                              <param-name>oracle.adf.view.rich.automation.ENABLED</param-name>
                              <param-value>true</param-value>
                              </context-param>

                              I added this to my web.xml, enabled the auto-generate testId option, but still my page source at runtime does not show any testId attribute.

                              I need to figure this out so as to be able to use Selenium for my ADF UI Testing. Any help is appreciated.

                              Thanks
                              Ramesh
                              • 12. Re: Selenium to test ADF UI Application
                                646884
                                I am facing a similar issue.Ramesh, Was this problem solved in your usecase? Or any other solution?
                                • 13. Re: Selenium to test ADF UI Application
                                  629225
                                  Can anybody please focus some light on this ?

                                  Thanks,
                                  • 14. Re: Selenium to test ADF UI Application
                                    629225
                                    looks like nobody is interested in ADF Testing

                                    Building Enterprise Applications requires a better Testing Tools

                                    Any inputs?
                                    1 2 Previous Next