Announcement

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

    Selenium type on StaticTextItem

    Hi,

    I have an automated test that enters a date into a StaticTextItem with a DateFormatter set. The problem is that in most of the time the text is not formatted (it is typed correctly).

    I tried to click on the element before entering the text and also pressing the TAB key after the text is entered, but with no success.

    The strange part is that a some occasions the text is correctly formatted. So this is an intermittent issue (most of the times it fails though).

    I'd like to know if there is anyway that I can force the text to be formatted.

    I'm using Smartclient v90p_2013-12-10_LGPL and Selenium webdriver v2.39.0. I'm testing it with Firefox v26.0.

    Thanks,

    #2
    We can't imagine a reason for *intermittent* problems formatting other than:

    1. you have a custom formatter that sometimes crashes

    2. you are delivering data to the component which is sometimes not a Date (a String instead for example).

    Let us know if you uncover anything that suggests an issue in SmartGWT, and we can take a look.

    Comment


      #3
      I can't tell you whether this is a SmartClient issue or not. What I know is that a simple element.sendKeys() didn't trigger the proper event (which seems to be the onBlur()).

      What I had to do (after try-and-error) is that I added the following code:

      Code:
      JavascriptExecutor executor = (JavascriptExecutor) driver;
      executor.executeScript("if (arguments[0].onfocus) arguments[0].onfocus();", elem);
      executor.executeScript("if (arguments[0].onblur) arguments[0].onblur();", elem);
      As I said, I don't know if this is a SmartClient issue, but I was expecting it to work fine.

      Comment


        #4
        Right, best guess, since you are directly calling WebDriver's element.sendKeys(), this just indicates it's failing to properly handle Tab. Possibly this is a platform-specific WebDriver issue.

        We don't currently have any kind of wrapper over the WebDriver API that would help here.

        Comment

        Working...
        X