🧸 Swift library which provides a high-level API to control a WKWebView
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Marionette.xcodeproj
Sources πŸŽ‰ Use requestAnimationFrame in waitForFunction Jan 22, 2019
Tests 🌹 Improve testing situation Jan 22, 2019
.gitignore πŸŽ‰ Add initial implementation Dec 4, 2018
Cartfile πŸŽ‰ Bump JSBridge to 1.0.0-alpha.13 Jan 23, 2019
Cartfile.resolved πŸŽ‰ Bump JSBridge to 1.0.0-alpha.13 Jan 23, 2019
Package.resolved πŸŽ‰ Bump JSBridge to 1.0.0-alpha.13 Jan 23, 2019
Package.swift πŸŽ‰ Bump JSBridge to 1.0.0-alpha.13 Jan 23, 2019
project.yml πŸŽ‰ Add initial implementation Dec 4, 2018
readme.md πŸŽ‰ Add initial implementation Dec 4, 2018

readme.md

Marionette

Marionette is a Swift library which provides a high-level API to control a WKWebView.

The goal is to have the API closely mirror that of Puppeteer.

Installation

SwiftPM

dependencies: [
    .package(url: "https://github.com/LinusU/Marionette", from: "1.0.0"),
]

Carthage

github "LinusU/Marionette" ~> 1.0.0

Usage

let page = Marionette()

firstly {
    page.goto(URL(string: "https://www.google.com/")!)
}.then {
    page.type("input[name='q']", "LinusU Marionette")
}.then {
    when(fulfilled: page.waitForNavigation(), page.click("input[type='submit']"))
}.then {
    page.screenshot()
}.done {
    print("Screenshot of Google results: \($0)")
}

Hacking

The Xcode project is generated automatically from project.yml using XcodeGen. It's only checked in because Carthage needs it, do not edit it manually.

$ mint run yonaskolb/xcodegen
πŸ’Ύ  Saved project to Marionette.xcodeproj