Does Geb support Windows WinApp Driver?

43 views
Skip to first unread message

Sagar Agarwal

unread,
Dec 18, 2018, 12:58:35 AM12/18/18
to Geb User Mailing List
Hi All,

I need to test an application that is a Desktop(Windows) application.

For this I came across WinAppDriver (https://github.com/Microsoft/WinAppDriver) which has been developed by Microsoft above Appium.

Using plain old Java, I am able to create and execute test cases using this. But when i tried with Geb/Spock, it is failing. 

with error as below:

java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.HashMap.newNode(HashMap.java:1747)
at java.util.HashMap.putVal(HashMap.java:631)
at java.util.HashMap.put(HashMap.java:612)
at java.util.HashSet.add(HashSet.java:220)
at org.aspectj.apache.bcel.generic.InstructionHandle.addTargeter(InstructionHandle.java:161)
at org.aspectj.apache.bcel.generic.MethodGen.<init>(MethodGen.java:300)
at org.aspectj.weaver.bcel.LazyMethodGen.initialize(LazyMethodGen.java:372)
at org.aspectj.weaver.bcel.LazyMethodGen.markAsChanged(LazyMethodGen.java:540)
at org.aspectj.weaver.bcel.LazyMethodGen.getBody(LazyMethodGen.java:929)
at org.aspectj.weaver.bcel.BcelShadow.makeShadowForMethod(BcelShadow.java:679)
at org.aspectj.weaver.bcel.BcelShadow.makeMethodExecution(BcelShadow.java:675)
at org.aspectj.weaver.bcel.BcelShadow.makeMethodExecution(BcelShadow.java:655)
at org.aspectj.weaver.bcel.BcelClassWeaver.match(BcelClassWeaver.java:2664)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:480)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1700)
at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1644)
at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1409)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1191)
at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:527)
at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:363)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:121)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)

[main] INFO com.athaydes.spockframework.report.internal.ConfigLoader - SpockReports config loaded: {com.athaydes.spockframework.report.showCodeBlocks=false, com.athaydes.spockframework.report.template.TemplateReportCreator.reportFileExtension=md, com.athaydes.spockframework.report.testSourceRoots=src/test/groovy, com.athaydes.spockframework.report.IReportCreator=com.athaydes.spockframework.report.internal.HtmlReportCreator, com.athaydes.spockframework.report.outputDir=build/spock-reports, com.athaydes.spockframework.report.internal.HtmlReportCreator.inlineCss=true, com.athaydes.spockframework.report.internal.HtmlReportCreator.featureReportCss=spock-feature-report.css, com.athaydes.spockframework.report.hideEmptyBlocks=false, com.athaydes.spockframework.report.internal.HtmlReportCreator.summaryReportCss=spock-summary-report.css, com.athaydes.spockframework.report.projectVersion=Unknown, com.athaydes.spockframework.report.template.TemplateReportCreator.specTemplateFile=/templateReportCreator/spec-template.md, com.athaydes.spockframework.report.template.TemplateReportCreator.summaryTemplateFile=/templateReportCreator/summary-template.md, com.athaydes.spockframework.report.internal.HtmlReportCreator.excludeToc=false, com.athaydes.spockframework.report.template.TemplateReportCreator.enabled=true, com.athaydes.spockframework.report.projectName=, com.athaydes.spockframework.report.template.TemplateReportCreator.summaryFileName=summary.md, com.athaydes.spockframework.report.internal.HtmlReportCreator.printThrowableStackTrace=false, com.athaydes.spockframework.report.internal.HtmlReportCreator.enabled=true}
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
[AppClassLoader@18b4aac2] warning javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified

geb.driver.DriverCreationException: failed to create driver from callback 'script15451124974521875017861$_run_closure1$_closure3@40c0937f'

at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
at geb.Configuration.createDriver(Configuration.groovy:382)
at geb.Configuration.getDriver(Configuration.groovy:371)
at geb.Browser.getDriver(Browser.groovy:111)
at geb.navigator.factory.BrowserBackedNavigatorFactory.<init>(BrowserBackedNavigatorFactory.groovy:35)



Can anyone please help to resolve this??

Alexander Kriegisch

unread,
Dec 18, 2018, 1:08:52 AM12/18/18
to geb-...@googlegroups.com
Sagar,

generally speaking (not about your tool in particular), IMO a callstack without the corresponding code to reproduce the problem is not particularly helpful.

Regards
--
Alexander Kriegisch
https://scrum-master.de
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+u...@googlegroups.com
> <mailto:geb-user+u...@googlegroups.com> .
> To post to this group, send email to geb-...@googlegroups.com
> <mailto:geb-...@googlegroups.com> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/d1a84a23-d722-4ae2-8421-e600bde021d0%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/d1a84a23-d722-4ae2-8421-e600bde021d0%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.

Sagar Agarwal

unread,
Dec 18, 2018, 1:22:47 AM12/18/18
to Geb User Mailing List
Hi Alexander,

This is more of a generic query, like whether Geb supports WindowsDriver. I provided the stack trace just for reference.
Anyways, as per your suggestion, I am adding the brief code to reproduce the problem in a comment below.

Thanks,
Sagar

Sagar Agarwal

unread,
Dec 18, 2018, 1:26:47 AM12/18/18
to Geb User Mailing List
Guys, below is the extract of my GebConfig.groovy file

import io.appium.java_client.windows.WindowsDriver
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.remote.DesiredCapabilities

System.setProperty("webdriver.chrome.driver","C:\\Softwares\\chromedriver.exe");

environments {
    driver = { getDriver("windows") }
}

private WindowsDriver getDriver(def browser) {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    //capabilities.setCapability("app", "C:\\Users\\sagar.agarwal\\AppData\\Local\\Apps\\2.0\\EHL7MW0R.0JM\\HP81KY5C.NKK\\acla..tion_0000000000000000_0001.0000_87ef52e3b0f01eb1\\ACLAIMQA.exe");
    capabilities.setCapability("app", "C:\\Users\\sagar.agarwal\\AppData\\Local\\Apps\\2.0\\EHL7MW0R.0JM\\HP81KY5C.NKK\\acla..tion_0000000000000000_0001.0000_59cc52c1d2f57881\\ACLAIM_QA1.exe");
    WindowsDriver AcclaimSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities);
    AcclaimSession
}

This is my Spec file

import geb.spock.GebReportingSpec
import spock.lang.Stepwise
import pageObjects.AcclaimLogin


@Stepwise
class TC001_CaseSearch_ByCaseID extends GebReportingSpec {

    def applicationPath = "absolutePath for the application";

    def "User is able to Search a Case with Case ID"() {
        when: "User logs in to the application using valid credentials"
            at Login()
        then: "login page should be dispalyed"
            print("success")
    }
}

Alexander Kriegisch

unread,
Dec 18, 2018, 1:29:39 AM12/18/18
to geb-...@googlegroups.com
I still cannot see any code, also no Spock/Geb configuration.


Sagar Agarwal schrieb am 18.12.2018 13:22:
>
> Hi Alexander,
>
>
> This is more of a generic query, like whether Geb supports WindowsDriver.
> I provided the stack trace just for reference.
>
> Anyways, as per your suggestion, I am adding the brief code to reproduce
> the problem in a comment below.
>
>
> Thanks,
>
> Sagar
>
>
> On Tuesday, December 18, 2018 at 11:38:52 AM UTC+5:30, Alexander Kriegisch
> wrote:
>> Sagar,
>>
>> generally speaking (not about your tool in particular), IMO a callstack
>> without the corresponding code to reproduce the problem is not
>> particularly helpful.
>>
>> Regards
>> --
>> Alexander Kriegisch
>> https://scrum-master.de
>>
>>
>> Sagar Agarwal schrieb am 18.12.2018 12:58:
>> >
>> > Hi All,
>> >
>> >
>> > I need to test an application that is a Desktop(Windows) application.
>> >
>> >
>> > For this I came across WinAppDriver
>> > (https://github.com/Microsoft/
>> <https://github.com/Microsoft/WinAppDriver> WinAppDriver)
>> > email to geb-user+u...@ <%20target=> googlegroups.com
>> > <mailto:geb-user+u...@ <%20target=> googlegroups.com> .
>> > To post to this group, send email to geb-...@googlegroups.com
>> <%20target=>
>> > <mailto:geb-...@googlegroups. <%20target=> com> .
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/
>> <https://groups.google.com/d/msgid/geb-user/d1a84a23-d722-4ae2-8421-e600bde021d0%40googlegroups.com>
>> msgid/geb-user/d1a84a23-d722-4ae2-8421-e600bde021d0%40googlegroups.com
>> > <https://groups.google.com/d/
>> <https://groups.google.com/d/msgid/geb-user/d1a84a23-d722-4ae2-8421-e600bde021d0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> msgid/geb-user/d1a84a23-d722-4ae2-8421-e600bde021d0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> > .
>> > For more options, visit https://groups.google.com/d/
>> <https://groups.google.com/d/optout> optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+u...@googlegroups.com
> <mailto:geb-user+u...@googlegroups.com> .
> To post to this group, send email to geb-...@googlegroups.com
> <mailto:geb-...@googlegroups.com> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/b4ab807c-c568-46ff-a73f-6f48bb46fc9b%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/b4ab807c-c568-46ff-a73f-6f48bb46fc9b%40googlegroups.com?utm_medium=email&utm_source=footer>

Sagar Agarwal

unread,
Dec 18, 2018, 1:34:59 AM12/18/18
to Geb User Mailing List
https://groups.google.com/d/msg/geb-user/tIdXZOh1nhc/uYRrtQK_CQAJ

I have added it as a comment. Above is the link for the same.
Please let me know if you need any more info.

Thanks,
Sagar  

Alexander Kriegisch

unread,
Dec 18, 2018, 1:37:32 AM12/18/18
to geb-...@googlegroups.com

I have not tried running your code yet, but I happen to be an AspectJ expert and thus noticed that you use AspectJ load-time weaving and there you are getting the out of memory error. Would you mind creating a very simple test case first and not use AspectJ in the first step? Just concentrate on playing around with that WindowsDriver (which implements an AppiumDriver which implements a RemoteWebDriver, i.e. there are several layers of abstraction and complexity already)? Thanks

--
Alexander Kriegisch
https://scrum-master.de
 
--

You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/2ef3ed70-7ab1-406b-9229-6339ffa0c21b%40googlegroups.com.

Sagar Agarwal

unread,
Dec 18, 2018, 1:49:02 AM12/18/18
to Geb User Mailing List
Hi Alexander,

I removed the AspectJ dependency. Out of memory error is gone. Now the error is as below

geb.driver.DriverCreationException: failed to create driver from callback 'script15451155621091875017861$_run_closure1$_closure3@60b71e8f'

at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
at geb.Configuration.createDriver(Configuration.groovy:382)
at geb.Configuration.getDriver(Configuration.groovy:371)
at geb.Browser.getDriver(Browser.groovy:111)
at geb.report.PageSourceReporter.getPageSource(PageSourceReporter.groovy:42)
at geb.report.PageSourceReporter.writePageSource(PageSourceReporter.groovy:38)
at geb.report.PageSourceReporter.writeReport(PageSourceReporter.groovy:29)
at geb.report.CompositeReporter.writeReport(CompositeReporter.groovy:31)
at geb.Browser.report(Browser.groovy:931)
at geb.spock.GebReportingSpec.report(GebReportingSpec.groovy:59)
at geb.spock.GebReportingSpec.cleanup(GebReportingSpec.groovy:46)
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:176)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.execute(WindowsDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:112)
at io.appium.java_client.windows.WindowsDriver.<init>(WindowsDriver.java:43)
at script15451155621091875017861.getDriver(script15451155621091875017861.groovy:24)
at script15451155621091875017861.run_closure1$_closure3(script15451155621091875017861.groovy:16)
at script15451155621091875017861.run_closure1$_closure3(script15451155621091875017861.groovy)
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
... 14 more


geb.driver.DriverCreationException: failed to create driver from callback 'script15451155621091875017861$_run_closure1$_closure3@60b71e8f'

at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:85)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
at geb.Configuration.createDriver(Configuration.groovy:382)
at geb.Configuration.getDriver(Configuration.groovy:371)
at geb.Browser.getDriver(Browser.groovy:111)
at geb.Browser.clearCookies(Browser.groovy:643)
at geb.Browser.clearCookiesQuietly(Browser.groovy:651)
at geb.spock.GebSpec.resetBrowser(GebSpec.groovy:50)
at geb.spock.GebSpec.cleanupSpec(GebSpec.groovy:79)
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Throwables.throwIfUnchecked(Ljava/lang/Throwable;)V
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:176)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.execute(WindowsDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:112)
at io.appium.java_client.windows.WindowsDriver.<init>(WindowsDriver.java:43)
at script15451155621091875017861.getDriver(script15451155621091875017861.groovy:24)
at script15451155621091875017861.run_closure1$_closure3(script15451155621091875017861.groovy:16)

Thanks.

Sagar Agarwal

unread,
Dec 18, 2018, 5:22:15 AM12/18/18
to Geb User Mailing List
The issue was with the version of Guava.
I updated the dependency as below and it got resolved.
<dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>24.0-jre</version>
        </dependency>


Thanks for the help.

Alexander Kriegisch

unread,
Dec 18, 2018, 5:49:44 AM12/18/18
to geb-...@googlegroups.com
I read that too late. I just came home and was able to try WinApp Driver, adapting the Windows Calculator example from JUnit to Geb. Because they used "findElementByName" and the names are localised to German on my platform, I had to fiddle around with finding out the names and translating them first, also parsing the displayed result is more difficult in the German version. But finally it is running beutifully. I actually wanted to clean up and refactor the sample code a bit for you before posting it, but it seems that your problem is resolved already and you also got a running test, right?
--
Alexander Kriegisch
https://scrum-master.de

>>>>> <https://github.com/Microsoft/WinAppDriver>
>>>>> <https://github.com/Microsoft/WinAppDriver>
>>>>> <https://github.com/Microsoft/WinAppDriver>
>>>>> <https://github.com/Microsoft/WinAppDriver>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to geb-user+u...@googlegroups.com
> <mailto:geb-user+u...@googlegroups.com> .
> To post to this group, send email to geb-...@googlegroups.com
> <mailto:geb-...@googlegroups.com> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/e9de8493-01c9-4bd8-befe-965b8b56cf1f%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/e9de8493-01c9-4bd8-befe-965b8b56cf1f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .

Alexander Kriegisch

unread,
Dec 18, 2018, 9:25:41 PM12/18/18
to geb-...@googlegroups.com

For what it is worth, I played around with WinApp Driver, refactored the Microsoft example to Geb and found out a few things:

  • You can get a pseudo HTML representation of the "page", but it does not make much sense to create page objects because
  • CSS selectors are unsupported,
  • XPath selectors are unsupported,
  • URLs for "to" and "at" checking do not really make sense (you could define a synthetic page with an "at" checker, but how would you navigate to that page?),
  • element "name" values are language-dependent,
  • so your best shot are the automation/accessibility IDs and a driver-specific method called findElementByAccessibilityId(String).
  • The only good news is that when extending GebReportingSpec, screenshots work just fine.

Provided you

  • activated developer mode in Windows,
  • downloaded and also started the automation host on the default port and
  • have something like this in your GebConfig.groovy file:
    import io.appium.java_client.windows.WindowsDriver
    import java.util.concurrent.TimeUnit
    
    (...)
    
    environments {
      // (...)
      win_app {
        driver = {
          DesiredCapabilities capabilities = new DesiredCapabilities()
          capabilities.setCapability("app", "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App")
          def windowsDriver = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities)
          windowsDriver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS)
          windowsDriver
        }
      }
    }
    

You can then run this test against the Windows Calculator application and see buttons being pushed and calculations done automatically from Geb:

package de.scrum_master.testing

import geb.spock.GebReportingSpec
import org.openqa.selenium.WebElement
import spock.lang.Requires
import spock.lang.Shared

/**
* Adapted from an example found at https://github.com/Microsoft/WinAppDriver
* and made to work with non-English calculator versions, too (tested with German)
*/

@Requires({ os.windows && sys["geb.env"] == "win_app" })
class CalculatorTest extends GebReportingSpec {

  def setup() {
    pushButtons("C")
    assert calculationResult == "0"
  }

  def addition() {
    when:
    pushButtons("1", "+", "7", "=")

    then:
    calculationResult == "8"
  }

  def subtraction() {
    when:
    pushButtons("9", "-", "1", "=")

    then:
    calculationResult == "8"
  }

  def multiplication() {
    when:
    pushButtons("9", "*", "9", "=")
    then:
    calculationResult == "81"
  }

  def division() {
    when:
    pushButtons("8", "8", "/", "1", "1", "=")

    then:
    calculationResult == "8"
  }

  def combination() {
    when:
    pushButtons("7", "*", "9", "+", "1", "=", "/", "8", "=")

    then:
    calculationResult == "8"
  }

  @Shared
  def buttonNames = [
    "1": "num1Button", "2": "num2Button", "3": "num3Button", "4": "num4Button", "5": "num5Button",
    "6": "num6Button", "7": "num7Button", "8": "num8Button", "9": "num9Button", "0": "num0Button",
    "+": "plusButton", "-": "minusButton", "*": "multiplyButton", "/": "divideButton",
    "=": "equalButton", "C": "clearButton"
  ]

  def pushButtons(String... buttons) {
    buttons.each {
      driver.findElementByAccessibilityId(buttonNames[it]).click()
    }
  }

  @Shared
  WebElement calculationResultElement = driver.findElementByAccessibilityId("CalculatorResults")

  def getCalculationResult() {
    return calculationResultElement.text
      .replaceAll("[^0-9]+", "")
      .replaceAll("[^0-9]*\$", "")
  }

}

--
Alexander Kriegisch
https://scrum-master.de


Marcin Erdmann

unread,
Dec 20, 2018, 5:44:52 AM12/20/18
to geb-...@googlegroups.com
Hey Alexander,

Thanks for sharing your experience with WinApp Driver. It's useful to know that WebDriver API can also be used to automate tests of Windows apps.

I think that using page object in that particular context still has it benefits (single definition of content across multiple tests for example) even if defining urls and navigating to them is not a thing. With regards to having to use findElementByAccessibilityId() - you can always add a syntax sugar method for that to a geb.content.Navigable based trait and mix it into your page classes.

Marcin

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/20181219022539.48F9766022F4%40dd39516.kasserver.com.
Reply all
Reply to author
Forward
0 new messages