import io.appium.java_client.windows.WindowsDriverimport org.openqa.selenium.WebDriverimport org.openqa.selenium.chrome.ChromeDriverimport org.openqa.selenium.chrome.ChromeOptionsimport org.openqa.selenium.remote.DesiredCapabilitiesSystem.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}
import geb.spock.GebReportingSpecimport spock.lang.Stepwiseimport pageObjects.AcclaimLogin@Stepwiseclass 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")}}
https://groups.google.com/d/msg/geb-user/tIdXZOh1nhc/uYRrtQK_CQAJ
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
--
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.
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;)Vat 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 moregeb.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;)Vat 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)
For what it is worth, I played around with WinApp Driver, refactored the Microsoft example to Geb and found out a few things:
Provided you
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
--
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.