Announcement

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

    Webdriver IE click doesn't seem to work

    Hello,

    I'm evaluating the use of Selenium Webdriver for the testing of SmartGWT.
    Firefox and Chrome work fine for me but I can't get Internet Explorer to work with SmartGWT. More specifically I can't get it to click on SmartGWT elements.

    I've followed the Installation and Setup process as described on the IE Webdriver project page.
    I've tried the click on different SmartGWT elements, including regular buttons.
    I've confirmed that the same setup can click on a Button on a non SmartGWT website, so I suspect it's not a general Webdriver issue.

    Here's a setup which should reproduce the problem:
    The SmartGWT Showcase:
    v10.0p_2015-04-01/LGPL Development Only (built 2015-04-01)

    isomorphic_webdriver.jar from the nightly build:
    SmartClient_SNAPSHOT_v101d_2015-04-02_LGPL

    Internet Explorer 11:
    Version: 11.0.9600.17690
    Updateversion: 11.0.17 (KB3032359)

    The testcase (supposed to click on "Grids" Checkbox):

    Code:
    //I've also tried adding IEDriverServer.exe to Path:
    System.setProperty("webdriver.ie.driver", "E:\\Testing\\Tools\\IE_Driver\\IEDriverServer.exe");
    SmartClientWebDriver driver = new SmartClientIEDriver();
    driver.setBaseUrl("");
    		
    //scLocator captured with Selenium IDE
    String scLocCheckbox="scLocator=//VLayout[ID=\"isc_Showcase_1_0\"]/member[Class=VLayout||index=0||length=1||classIndex=0||classLength=1]/member[Class=HLayout||index=0||length=2||classIndex=0||classLength=1]/member[Class=SplitPane||index=0||length=2||classIndex=0||classLength=1]/rightLayout/member[Class=TabSet||index=0||length=1||classIndex=0||classLength=1]/tabPane[title=Home%26nbsp%3B%26nbsp%3B||ID=main_tab||index=0]/member[Class=VLayout||index=0||length=1||classIndex=0||classLength=1]/member[Class=DynamicForm||index=0||length=2||classIndex=0||classLength=1]/item[name=gridsCB||title=Grids||value=true||index=17||Class=CheckboxItem]/valueicon";
    
    driver.get("http://localhost:8080/showcase/#main"); //your showcase URL
    driver.click(ByScLocator.scLocator(scLocCheckbox));
    Best regards,
    Andre

    #2
    Your sample code works for us.

    Windows 7 SP1 x64,
    IE11 version 11.0.9600.17691
    Update Versions: 11.0.17 (KB3032359)
    IEDriverServer x64 2.45.0

    What OS are you running?
    What version of the IEDriver do you have installed (including x86 vs. x64)?
    Does it work if you use a URL pointing to our public showcase - i.e. http://www.smartclient.com/smartgwt/showcase/#main?

    Comment


      #3
      Hello all,

      I noticed version differences here. Is it OK to mix the 5.0p sample with 5.1d libs?

      Best regards,
      Blama

      Comment


        #4
        No, it's not recommended, but in this case it didn't seem to be the source of the problem since it worked fine (for us) that way.

        Comment


          #5
          Thanks for trying it on your end.

          Here are my specs again, with OS and IEDriver Version:

          Windows 8.1 x64
          IE11 version 11.0.9600.17690
          Update Versions: 11.0.17 (KB3032359)
          IEDriverServer x64 2.45.0

          I've tried it with your showcase "http://www.smartclient.com/smartgwt/showcase/#main" and it didn't work for me either.

          I should also add that the testcase I provided lacks a assertion at the end that would check that the "Grids" checkbox is selected. It doesn't throw an error, it's just that the checkbox isn't selected as expected. I did try making an assertion, but it didn't work out as expected either, so right now one has to manually veryfy if the Checkbox was clicked or not. In my case the checkbox is not clicked.

          Comment


            #6
            We are able to reproduce the problem in Windows 8.1, but this appears to be a problem with how Selenium interacts with IE11 in Windows 8.1, and not something introduced by our layer of code.

            Specifically, trying to execute JavaScript on IE throws a JavaScript error.

            Do you receive an exception in Eclipse (or wherever you're running your sample)? We receive:

            Code:
            Exception in thread "main" org.openqa.selenium.WebDriverException: JavaScript error (WARNING: The server did not provid\
            e any stacktrace information)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                at java.lang.reflect.Constructor.newInstance(Unknown Source)
                at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
                at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
                at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
                at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
                at com.isomorphic.webdriver.SmartClientWebDriver.click(SmartClientWebDriver.java:624)
                at Test.main(Test.java:24)
            When you said that you were able to run WebDriver on IE11 against non-Isomorphic pages, did you attempt to execute JS?

            You might wish to follow the discussion here:
            https://code.google.com/p/selenium/i...detail?id=8302

            Comment


              #7
              I don't receive an exception in Eclipse when I run Javascript or use driver.click() (which as I understand uses Javascript internally) on the SmartGWT showcase, it just doesn't seem to work. Equally the Webdriver way of clicking "driver.findElement().click()" doesn't work for me on the showcase either and it supposedly uses browser native events instead of Javascript if I remember correctly.

              I did try a non SmartGWT website again and I get Javascript exceptions whenever I use the SmartClientWebDriver "driver.click()" for example, but not when I run Javascript directly or use the Webdriver way of clicking.

              Example test:

              Code:
              	@Test
              	public void javascriptTest() throws InterruptedException {
              		System.setProperty("webdriver.ie.driver",
              				"E:\\Testing\\Tools\\IE_Driver\\IEDriverServer.exe");
              		SmartClientWebDriver driver = new SmartClientIEDriver();
              		driver.setBaseUrl("");
              		driver.get("www.google.com");
              		driver.findElement(ByScLocator.name("btnI")).click(); //works for me
              		driver.get("www.google.com");
              		driver.assertEval("document.getElementsByName('btnI').item(0).click(); return true;", true); //works for me  
              
              		boolean pageReady = false;
              		while (!pageReady) {
              			Thread.sleep(100);
              			pageReady = driver.assertEval("return document.readyState == \"complete\"", true); //works for me
              		}
              
              		driver.get("www.google.com");
              		driver.click(By.name("btnI")); //exception is thrown
              	}

              Here is the exception I receive when I use driver.click() on google

              Code:
              org.openqa.selenium.WebDriverException: JavaScript error (WARNING: The server did not provide any stacktrace information)
              Command duration or timeout: 111 milliseconds
              Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'
              System info: host: 'asc26', ip: '192.168.150.26', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_20'
              Driver info: org.openqa.selenium.ie.InternetExplorerDriver
              Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:19670/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
              Session ID: 802f99c4-5415-40d6-8b0a-527539132e69
              	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
              	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              	at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
              	at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
              	at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
              	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
              	at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
              	at com.isomorphic.webdriver.SmartClientWebDriver.click(SmartClientWebDriver.java:656)
              	at webtesting.IETest.javascriptTest(IETest.java:60)
              	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              	at java.lang.reflect.Method.invoke(Method.java:483)
              	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
              	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
              	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
              	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
              	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
              	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
              	at org.testng.TestRunner.privateRun(TestRunner.java:767)
              	at org.testng.TestRunner.run(TestRunner.java:617)
              	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
              	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
              	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
              	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
              	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
              	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
              	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
              	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
              	at org.testng.TestNG.run(TestNG.java:1057)
              	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
              	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
              	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

              Comment


                #8
                The problem may be related to native events in IE11 in this case. Does turning off native events work for you? It can be achieved by creating SmartClientWebDriver as follows:
                Code:
                    DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
                    caps.setCapability("nativeEvents",false);
                    SmartClientWebDriver driver = new SmartClientIEDriver(caps);

                Comment


                  #9
                  Yes, this worked for me. Thanks for the help!
                  Do I have to expect that my tests or smartGWT will behave differently in any way, if I run IE without native events, while Chrome and FireFox with native events?

                  Comment


                    #10
                    Native events are recommended over synthetic events because they simulate user interactions "better," so there might be some difference when IE is driven this way - but we're not aware of any specific limitation. You can look at https://code.google.com/p/selenium/w...nthetic_events for an overview of native events, though the browser table is likely out of date. You can let us know of any specific issues with this approach, but there's no guarantee they can be solved in our code layers.

                    This appears to be an issue with WebDriver not being able to use native events in IE11 in Windows 8.1 (no issue in Windows 7 SP1), and thus is not within Isomorphic's control - it's an issue that Selenium must work out with Microsoft. You can see a discussion of this issue here: https://code.google.com/p/selenium/i...detail?id=4403.

                    Note also that in our docs we still recommend Selenium V1.0 over WebDriver: http://www.smartclient.com/docs/10.0...tomatedTesting.

                    Comment


                      #11
                      Thanks for the input, this really helps a lot.
                      The Issue 4403 seems to be indeed the one I have. Another workaround than to disable the native events was suggested in that discussion:
                      Code:
                      caps.setCapability("requireWindowFocus", true);
                      This also works for me (with the side-effect that Webdriver now moves the mouse cursor).

                      I've noticed your recommendation to use Selenium 1.
                      Most of the reasons against Webdriver in your documentation are not an issue for me or my colleagues (Apart from the browser compatibility problems, as has become painfully obvious by this issue). On the other hand I found the Webdriver API easier to work with, despite it's quirks, so Im hoping to make it work. My evaluation results so far look mostly positive (after having found solutions for several other weird problems) the Internet Explorer issue was somewhat of a bad surprise though. Thanks again for helping me find several workable solutions.

                      Comment

                      Working...
                      X