Announcement

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

    Selenium WebDriver support

    I'm using Selenium WebDriver to automate large portions of our QA process and have read through the documentation at "Using Selenium" (https://www.smartclient.com/smartgwt...gSelenium.html), but this appears to indicate that SmartClient users need to use the older, web-based IDE version of Selenium as opposed to WebDriver itself.

    However, in order to target specific UI elements (Buttons, MenuButtons, MenuItem, etc.), I need to obtain a specific ID or XPath to address the element, otherwise the automation will fail. Unfortunately, when, for example, switching from one view to the next, then back, the IDs associated with its member components changes dynamically. So, an ID or XPath cannot be reliably used to select the element and simulate a click on the element.

    I've attached state1.jpg, state2.jpg from the Beanless Mode Feature Explorer example

    (http://www.smartclient.com/#FShibernateConnector).

    1. Open the Chrome browser (though, note that this behavior happens in all other browsers I've checked, as well).
    1. Open SmartClient Feature Explorer.
    2. Open Chrome Developer tools
    2. Open the tree item "Beanless mode" under "Hibernate / Beans."
    3. Select the "hibernateConnector.js" tab.
    4. Inspect the "Try it" button with Chrome Dev Tools. In this particular instance, it initially has an XPath of //*[@id="isc_12C"]/table/tbody/tr/td and an ID of isc_12C.
    5. Switch to another tree item ("HB Auto Derivation", for example).
    6. Switch back to "Beanless Mode."
    7. Click the "hibernateConnector.js" tab.
    8. Inspect the "Try it" button with Chrome Dev Tools. The "Try it" button now has an XPath of //*[@id="isc_1A5"] and an ID of isc_1A5.

    Obviously, this is only an example, as the IDs seem to be randomly generated, or programmatically incremented upon creation based on historical elements. Either way, there does not seem to be a consistent way to auto-select the elements.

    I'd like to add a name or any other XPath-selectable component to the tag that *does not change*. There doesn't seem to be any easy way for our developer to do this in SmartClient without a large number of changes to the existing codebase.

    Am I wrong, or is there a better way to do this that I'm just missing? So far, I am not able to get a consistent object to target my simulated clicks upon.

    I appreciate your help.

    Click image for larger version

Name:	state1.png
Views:	231
Size:	215.9 KB
ID:	232394

    Click image for larger version

Name:	state2.png
Views:	249
Size:	212.1 KB
ID:	232395

    #2
    Actually, the documentation says that you can use WebDriver or Selenium RC, then gives trade offs.

    The documentation also covers strategies for ensuring you have unique IDs that never contain generated parts.

    We'd suggest giving it a thorough re-read, then come back if you still have questions.

    Comment


      #3


      I read your document and from that i am not able to get clear understanding by which i can use scLocator (It's a locator created by Smart GWT ) in my selenium webdriver code to get constant values for WebElements.
      I've added the extensions found in the smart gwt 2.4 distribution to the Selenium IDE,
      With the help of that we get scLocator as you guided in the document
      (http://www.smartclient.com/smartgwt-...gSelenium.html),
      but when I try to personalize my scripts (written on java language), It doesn't work.
      Selenium WebDriver not recognizing scLocator.
      And along with that i dont want to use Selenium RC.
      So guide something specific by which i can easily use scLocator for finding specific values in selenium code(written on java language).

      Comment


        #4
        It looks like you've somehow missed the primary document on Automated Testing, this one:

        http://www.smartclient.com/smartgwt-...edTesting.html

        .. which covers WebDriver usage. Please take a look.

        Comment


          #5
          Thanks for the Document.
          But now i want to find ScLocator for a particular table which i am not able to find.
          With the help of FireBug Selector i am able to find ScLocator of Body Tag in Selenium IDE but i am searching ScLocator of particular Table inside that Body.
          And not able to select table which is inside the body with the help of Firebug Selector.
          And also not able to get ScLocator by Right Click on the particular Element as suggested in the document.
          So Is their any other way that we can create ScLocator manually Similarly like we create Xpath manually in WebDriver as per the tags?
          Or is their any document which specifies clearly that how to create ScLoctor Manually ?
          Last edited by pkothari; 12 Nov 2015, 07:47.

          Comment


            #6
            You say you are 'unable' to use the approaches explained in the docs - but you say nothing about what is actually going wrong.

            In general, if something is going wrong, you do need to tell us what's going wrong in order for us to help.

            The documentation of the AutoTest system does explain other ways to retrieve locators, both programmatically and with built-in interfaces in the Developer Console. However you probably want to first figure out what's wrong with your Selenium IDE - probably just a matter of not installing the user extensions, running the wrong version of Selenium IDE, or some other installation problem.

            Comment

            Working...
            X