Announcement

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

    Selenium click became unreliable after SmartGWT upgrade

    Hi

    I am working for company which uses SmartGWT in their project. And until recently they used SmartGWT version 4. Tests that I have been writing for that project were working fine.
    Problems started after upgrade from version 4 to version 5. There were needed some changes in tests (like SmartClient locator changes).
    However, one (so far unfixable) part was that clicks became unreliable.

    I was searching on Selenium forum, and accepted solutions were that click executes before element is shown on page. I have tried to insert and increase waiting time (pauses) between actions and to set focus on element before executing click method, however problem remained.
    Basically click sometimes happen, sometimes don't (click method just sets focus on element without making actual click).

    I would like to point out again, that before upgrade clicks were reliable.

    Does someone know what might be a problem?

    I am suspecting that somehow SmartGWT click event doesn't get triggered, but I could be wrong.

    Regards
    Last edited by drax; 8 Sep 2015, 04:06.

    #2
    Have you read through the Using Selenium topic in the SGWT Javadocs: http://www.smartclient.com/smartgwt-...gSelenium.html? In particular, note how we discuss why we automatically insert a watiForElementClickable() command before each click() or other command when you use Selenium IDE to generate a script with our user extensions.

    Comment


      #3
      Originally posted by Isomorphic View Post
      Have you read through the Using Selenium topic in the SGWT Javadocs: http://www.smartclient.com/smartgwt-...gSelenium.html? In particular, note how we discuss why we automatically insert a watiForElementClickable() command before each click() or other command when you use Selenium IDE to generate a script with our user extensions.
      Thanks for reply. Yes, however it is not much helpful for me. We used custom built ExpectedCondition which checked if element is clickable.
      I have tried to change that to built-in method: ExpectedConditions.elementToBeClickable() with custom built SmartClient locator.
      Now I am encountering issue that element gets registered as clickable even it isn't (it happens when modal dialog shows, which prevents clicks) and then is thrown exception
      Code:
      org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (22, 12).
      which I tried to catch but without success.

      Another thing, I have tried to use SeleniumIDE and indeed it shows operations waitForElementClickable(), however, I can't translate that to Java code.
      I have actually tried export function, but I am getting these messages in generated test class:

      Code:
        public void testAsd() throws Exception {
          driver.get(baseUrl + "/project/");
          // ERROR: Caught exception [unknown command [waitForElementClickable]]
          // ERROR: Caught exception [Error: unknown strategy [sclocator] for locator [scLocator=//ToolStrip[ID="mainMenu"]/member[Class=HLayout||index=0||length=5||classIndex=0||classLength=1]/member[Class=MenuButton||index=0||length=5||classIndex=0||classLength=5||roleIndex=0||roleLength=5||title=Project||scRole=button]/]]
          // ERROR: Caught exception [unknown command [waitForElementClickable]]
          // ERROR: Caught exception [ERROR: Unsupported command [mouseMove | scLocator=//autoID[Class=Canvas||index=0||length=1||classIndex=0||classLength=1]/child[Class=VLayout||index=1||length=2||classIndex=0||classLength=1]/member[Class=TabSet||index=1||length=3||classIndex=0||classLength=1]/ | ]]
        }
      This is custom built locator:
      Code:
       static class SCLocator extends By implements Serializable {
              private static final long serialVersionUID = 1677275846784748371L;
              private String locator
      
              SCLocator(String locator) {
                  super()
                  //smart client locator (eg. //Window[ID="123"])
                  this.locator = locator
              }
      
              @Override
              List<WebElement> findElements(SearchContext searchContext) {
                  WebElement el = searchContext.executeScript("return isc.AutoTest.getObject(arguments[0]);", locator)
                  return [el]
              }
      
              @Override
              WebElement findElement(SearchContext searchContext) {
                  WebElement el = searchContext.executeScript("return isc.AutoTest.getObject(arguments[0]);", locator)
                  return el
              }
      
              @Override
              public String toString() {
                  return "By SCLocator: " + locator
              }
          }
      Last edited by drax; 9 Sep 2015, 07:37.

      Comment


        #4
        I am facing the same issue. Any solution for above mentioned. I can't translate Selenium IDE recording to Java code.

        Comment


          #5
          Both of you above: as we covered above, we provide a waitForElementClickable() because the built-in ones have various flaws. Use ours.

          Comment


            #6
            as we covered above, we provide a waitForElementClickable() because the built-in ones have various flaws. Use ours.
            have been using the one which is mentioned by you. Please check screen shot
            Attached Files

            Comment


              #7
              Then you are not facing the same issue as the poster above, and you should start a new thread, and provide details that will allow the problem to be reproduced.

              Comment

              Working...
              X