Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/LinusU/Marionette
🧸 Swift library which provides a high-level API to control a WKWebView
https://github.com/LinusU/Marionette
automation headless headless-browsers ios macos wkwebview
Last synced: 3 months ago
JSON representation
🧸 Swift library which provides a high-level API to control a WKWebView
- Host: GitHub
- URL: https://github.com/LinusU/Marionette
- Owner: LinusU
- License: mit
- Created: 2018-12-04T17:19:44.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-12T15:38:28.000Z (over 5 years ago)
- Last Synced: 2024-07-27T19:45:00.764Z (4 months ago)
- Topics: automation, headless, headless-browsers, ios, macos, wkwebview
- Language: Swift
- Homepage:
- Size: 49.8 KB
- Stars: 411
- Watchers: 8
- Forks: 14
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# 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](https://github.com/GoogleChrome/puppeteer).
## Installation
### SwiftPM
```swift
dependencies: [
.package(url: "https://github.com/LinusU/Marionette", from: "1.0.0"),
]
```### Carthage
```text
github "LinusU/Marionette" ~> 1.0.0
```## Usage
```swift
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](https://github.com/yonaskolb/XcodeGen). It's only checked in because Carthage needs it, do not edit it manually.
```sh
$ mint run yonaskolb/xcodegen
💾 Saved project to Marionette.xcodeproj
```