Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    Need help with triggering 'onclick'

    Originally posted by uberto
    I found a workaround (for buttons) to be able to test with Selenium:

    make sure to assign ID to your buttons;
    yourButton.setID("AddUserBtn");

    then in selenium replace the XPath from the recorder (that use temporary id) with something like:
    //div[@eventproxy="AddUserBtn"]/table/tbody/tr/td

    and then replace click event with KeyPress using blank as Value.

    now it works fine.

    Hi,

    I'm trying to apply your workaround to a script using Selenium RC (for IE) where I am trying to trigger the 'onclick' event associated with a button on a website.

    Could you please elaborate and provide and example of what is required to make this work.

    Thank you so much,
    dan

    Comment


      #17
      Selenium integration

      I am also looking forward to be able to run Selenium on SmartGwt apps.
      Could you update if there is any progress on this.

      Is there is any other workable framework.

      I guess HtmlUnit would also suffer the same issue.

      Comment


        #18
        Deadline for selenium compatibility ?

        I have a project which will start in one month and i want to buy for my company the smartgwt EE pro License.
        Can you please tell me when will we have the selenium compatibility ?
        Thank you

        Comment


          #19
          Selenium RC running SmartClient App

          I've been playing with the FitNesse, WebTest and Selenium RC combination of tools (not Selenium by itself), and I'm new to them all. By providing a user-extentions.js to Selenium, I've been able to find form elements and click buttons. That's as far as I've gotten, but that much seems to work. A couple of steps were needed to get this working.

          1. Expose the apps global object via: document.globalObj = window.
          This provides a way for the user-extentions to get at the apps globals.

          2. Provide overrides in the user-extensions.js to look for SmartClient specific stuff too. (My file is attached.)

          I got errors that some methods were not defined, so had to pull in some more methods to get my extensions to work. This may be able to be cleaned up more, but it's a start. Maybe some of the rest of you can join in and we can get something working as a community.

          Hope this helps some,
          TT
          Attached Files

          Comment


            #20
            @ttubbs If you're game to dig into this, take a look in an LGPL package at source/client/tools/AutoTest.js. The two key APIs in here - getLocator(element) and getElement(locator) - provide a DOM-structure-independent way to get handles to SmartClient components for capture and replay test recording. This is what SOASTA (our test partner) uses and it's open for anyone else to integrate in this way.

            Comment


              #21
              Good to know. Thanks for the tip.

              As I get time, I might dig into this more. I'm new to these tools, so I don't even know at this point how to get any js other than the user-extentions.js plugged into the testing framework.

              I'll be sure to update this list if/when I make any progress on this. No promises though.

              TT

              Comment


                #22
                Note that the functionality in AutoTest.js is already present in ISC_Core.js, at least for smartclientSDK (as opposed to smartclientRuntime).

                Comment


                  #23
                  Also good to know. Not sure how that helps at this point. It seems Selenium is running in one window/frame and my app in another. SmartClient libraries are not available in Selenium (where I need to make use of AutoTest), and I cannot find a way to load them there. So, I think it is ugly, but I can expose my app's global object like I said before so that in user-extentions.js I can do something like this:

                  Code:
                  isc = inDocument.globalObj.isc;
                  isc.AutoTest.getElement(...
                  BUT, If you could provide a bit more details on how to use AutoTest, it would be very helpful. Consider...

                  In the user-extentions.js I uploaded previously:
                  Code:
                  // Returns the <input> element
                  inDocument.globalObj['userName'].getDataElement()  
                  
                  // Clicks the SmartClient button
                  inDocument.globalObj['logonButton'].click()
                  But, I am guessing you are suggesting doing code like the following instead?
                  Code:
                  isc.AutoTest.getElement(isc.AutoTest.getLocator(inDocument.globalObj['userName']))  
                  // This returns null, not the <input> I expected
                  
                  isc.AutoTest.getElement(isc.AutoTest.getLocator(inDocument.globalObj['logonButton'])).click()
                  // this returns a div (in FF anyway), which does not have a click() method
                  Last edited by ttubbs; 27 Oct 2009, 07:33.

                  Comment


                    #24
                    bump bump bump

                    Comment


                      #25
                      A progress ?

                      Originally posted by ttubbs
                      bump bump bump
                      ttubbs, i didn't see that there was a progress in this thread.
                      I don'nt have enough skill in Javascript but i'm going to improve my knowledge in order to make Smartgwt compliant to selenium, if possible.

                      Where can we download or have documentation on autoTest.js ?

                      For the user-extentions.js file, what version of selenium do you use ?

                      I need to have the same environnement than you so i can participate.
                      Thank you.

                      Comment


                        #26
                        I don't know where to go next.

                        AutoTest.js is inside the LGPL version of SmartClient
                        I downloaded selenium-remote-control-1.0.1-dist.zip.

                        I am just not able to click on an element using my current setup (FitNesse, WebTest, Selenium RC, SmartClient). I experimented with the stuff in AutoTest, and did make some progress, but it is SmartClient specific code that I don't really like needing to do. (Finding eventproxy or looping up parentElements to find a subcomponent such as the close button on a window). Just ugly code.

                        I should be able to send a click event to an element on the page just as if I am clicking the mouse there. I've put traces in my Selenium user-extentions.js, and can see that the same elements I click with the mouse are being sent a click event as well. The app just sits there and doesn't do a thing.

                        Another guy on the team has been working with Googles WebRunner (which looks to use Selenium under the covers, thought he inports are not the same package names). He is able to get a button or grid cell element (both <td>s) send them a click() message, and the app responds as expected. He's using this to run JUnit tests.

                        I don't know what Voodoo is being done in WebRunner that makes a click on the same dang elements work there but not for me in WebTest/Selenium RC.

                        I guess I'll have to see if WebRunner source is available and see what they are doing in their click method.

                        It seems SmartClient triggers alot of stuff off of mouseUp instead of click, so maybe something to explore there.

                        Comment


                          #27
                          AutoTest.js has two very very simple, elegant APIs you should use, the previously mentioned getLocator(element) and getElement(locator). All of the rest is internal concerns of the framework, that's the whole point.

                          If Selenium takes shortcuts and does not simulate a true click (mouseDown, mouseUp, click) then yes most SmartClient elements will not respond to that. So that may well be the problem. Perhaps you can find a setting to enable true event series to be sent.

                          Comment


                            #28
                            WebDriver (not WebRunner)

                            First, I lied. The Google product is called WebDriver (not WebRunner).

                            Second, it seems that there has been some chatter on OpenQA for over a year about merging WebDriver and Selenium. I cannot find that this has happened yet. However, there is something called SpiderFixture, a WebDriver backed fixture for FitNesse (which is what I am mostly interested in). I plan to explore that combo some to see if it makes things easier going.

                            As a test, I intercepted the 'click' event in my user-extentions.js fiile, and manually sent a 'mousedown', 'mouseup', and 'click'. This did improve things slightly, it made my button show in a focused and selected state. However, the click still did not process.

                            I've attached my latest user-extensions.js for any who care.
                            Attached Files

                            Comment


                              #29
                              Good News - I Think...

                              I have had some success today using a different mix of tools:
                              FitNesse, FitLibrary, FitLibraryWeb (SpiderFixture), WebDriver

                              After much trial and error (the docs are not so good for a newbie), I have been able to get something to click in my SmartClient app.

                              I downloaded the latest libraries listed above. The SpiderFixture is backed by WebDriver, and since we had success with that in JUnit, I thought I'd give it a try for FitNesse. It did not process the click as I expected it would. Again, after much trial and error, I discovered that the version of WebDriver packaged with FitLibraryWeb is older than the one we are using in the JUnit tests. I copied over the newer version into my FitNesse lib folder, and like magic I can click on elements.

                              At this point, I think I am going to explore with this set of tools and leave off where I was with the Selenium stuff. But, I've got a new assignment that is going to keep me out of testing for a few weeks to a month. I'll be sure to provide any updates in the future should I have any more to give.

                              Thanks & Good Luck All,
                              TT

                              Comment


                                #30
                                ButtonItem

                                Yeah it would be great if we had a setID with each selenium widget.

                                Do we have a way to trap buttonItem. Precisely I want to click a buttonITem widget.
                                I wasnt also able to get a handle to the form element even after setting the ID tag.

                                Any help would eb really appreciated

                                Comment

                                Working...
                                X