Silk AppDriver

October 9, 2017 ยท View on GitHub

Silk AppDriver is an implementation of the W3C WebDriver protocol for native (Windows) and mobile (Android and iOS) applications, built on top of Silk Test. The purpose of this project is to enable users of Silk Test to write tests for all kinds of applications using the WebDriver API in addition to the existing Silk Test APIs.

Prerequisites

Running

  • Download the latest Silk AppDriver release from GitHub
  • Run the Silk AppDriver server from the command line: java -jar silk-appdriver.jar
  • Run your tests against a RemoteWebDriver pointed to that server (http://localhost:8080 by default)
  • To use a different port than 8080 run Silk AppDriver with the server.port system property, for example java -Dserver.port=8123 -jar silk-appdriver.jar

Examples

Here's a minimal example written in Python that automates notepad.exe using Silk AppDriver:

from selenium import webdriver

driver = webdriver.Remote(
  command_executor='http://127.0.0.1:8080',
  desired_capabilities={'app': '%WINDIR%\\notepad.exe'})

textfield = driver.find_element_by_xpath("//TextField")
textfield.clear()
textfield.send_keys("hello from python!")

driver.find_element_by_xpath("//Menu[@caption='File']").click()
driver.find_element_by_xpath("//MenuItem[@caption='Exit']").click()
driver.find_element_by_xpath("//PushButton[@caption=\"Don't Save\"]").click()

driver.quit()

Further examples can be found here:

Building

To build Silk AppDriver on the command line:

  • Make sure you have silktest.jtf:18.0 in your local maven repository (See "Adding the JTF to your local Maven repository" in our "Embracing Open Source" blog post.)
  • Build the project with maven (mvn clean install)
  • Run the Silk AppDriver server from the command line: java -jar target/silk-appdriver.jar

To build Silk WebDriver in the IDE:

  • Import the Silk AppDriver project into Eclipse (at least 4.6.0) and build with maven.

Architecture

Noteworthy

The controller stub was auto-generated based on the "List of Endpoints" in the WebDriver standard using a simple Silk4J script. That can be found here: appdriver-generate

Current status

Silk AppDriver is still in an early stage and needs your help and contributions to get better!

Locator strategies

Only xpath is currently supported as a locator strategy. Ony "Silk Test xpath" locators will work.

API

The following table lists all methods listed in the W3C spec and the current status of the implementation in Silk AppDriver.

CommandStatusComment
New SessionDone
Delete SessionDone
StatusDone
Get TimeoutsTODO
Set TimeoutsTODO
GoDoneNot supported (yields "unknown command")
Get Current URLDoneNot supported (yields "unknown command")
BackDoneNot supported (yields "unknown command")
ForwardDoneNot supported (yields "unknown command")
RefreshDoneNot supported (yields "unknown command")
Get TitleDone
Get Window HandleDone
Close WindowDone
Switch To WindowDone
Get Window HandlesDone
Switch To FrameDoneNot supported (yields "unknown command")
Switch To Parent FrameDoneNot supported (yields "unknown command")
Get Window RectDone
Set Window RectDone
Maximize WindowDone
Minimize WindowDone
Fullscreen WindowDone
Get Active ElementTODO
Find ElementDone
Find ElementsDone
Find Element From ElementDone
Find Elements From ElementDone
Is Element SelectedTODO
Get Element AttributeTODO
Get Element PropertyDone
Get Element CSS ValueDoneNot supported (yields "unknown command")
Get Element TextDone
Get Element Tag NameDoneYields the class name
Get Element RectDone
Is Element EnabledDone
Element ClickDone
Element ClearDone
Element Send KeysPartly doneMissing: Handling of special keys
Get Page SourceDoneNot supported (yields "unknown command")
Execute ScriptDoneNot supported (yields "unknown command")
Execute Async ScriptDoneNot supported (yields "unknown command")
Get All CookiesDoneNot supported (yields "unknown command")
Get Named CookieDoneNot supported (yields "unknown command")
Add CookieDoneNot supported (yields "unknown command")
Delete CookieDoneNot supported (yields "unknown command")
Delete All CookiesDoneNot supported (yields "unknown command")
Perform ActionsTODO
Release ActionsTODO
Dismiss AlertTODO
Accept AlertTODO
Get Alert TextTODO
Send Alert TextTODO
Take ScreenshotDoneTakes a screenshot of the entire desktop
Take Element ScreenshotDone

TODOs

The biggest TODOs currently are:

  • Add more tests!
  • Add tests in other Selenium languages!
  • Implement the ability to specify more of the Silk Test BaseState options (through capabilities?)
  • Implement attribute/property retrieval. Do we need to distinguish between the two?
  • Implement handling special keys in sendKeys (map to Silk Test keys!)
  • Implement screenshot API
  • Implement customizable timeouts and other options
  • Implement window handling and switching between multiple windows
  • Add a possibility to get TrueLog files. Maybe we can use executeScript with a custom command to start/stop TrueLog?
  • Implement other locator strategies (by Id, by className, ... should be easy to map to XPath)
  • Implement alert handling
  • Implement action API
  • Add support for mobile and web apps
  • The Java client bindings (among others) support a Select helper method. Internally this relies on a couple of specifics (tag name has to be "select", children have to be "options", ...). Can we make that work with our combo boxes as well?

License

Code provided in this repository is licensed under the Apache 2.0.

Contribution

You want to contribute to Silk AppDriver? Great!

Changes may be contributed after signing the Micro Focus Individual Contributor License Agreement 1.0. Signed contributor agreements are to be sent, via PDF, to licensing@microfocus.com. You will be notified via email when the agreement has been accepted by Micro Focus.