Erik


Erik is a headless browser based on WebKit and HTML parser Kanna.
An headless browser allow to run functional tests, to access and manipulate webpages using javascript.
Navigation
Go to an url
How to get current url?
For multiple browsing you can create an instance of headless browser and use same functions
HTML Inspection
Search for nodes by CSS selector
Edit first input field with name "user"
Submit a form
Evaluate some JavaScript
capturedValue
is the content of JavaScript variable resultErik
Affect this variable in your JavaScript code.
Warning about DOM change
:warning: All action on Dom use JavaScript and do not modify the actual
Document
object and its children Element
.
You must use currentContent
to get a refreshed Document
object
Get current content
Using Future
As an optional feature, you can use Future/Promise ( Erik use frameworks BrightFutures & Result)
Example to submit a google search
Limitation
On iOS 9 and macOS 10.11, you need to ensure you use https://, because iOS 9 and macOS 10.11 do not like apps sending or receiving data insecurely. If this something you want to override, click here to read about App Transport Security.
Links
Setup
Using cocoapods
CocoaPods is a centralized dependency manager for
Objective-C and Swift. Go here
to learn more.
-
Add the project to your Podfile.
-
Run
pod install
and open the.xcworkspace
file to launch Xcode.
Optional Future
Add pod 'Erik/Future'
to your Podfile
and run pod install
.
Using carthage
Carthage is a decentralized dependency manager for Objective-C and Swift.
-
Add the project to your Cartfile.
github "phimage/Erik"
Roadmap
- [ ] (WIP) WKWebView screenshot (webkit view privates api?)
Why Erik?
A well known headless browser is named PhantomJS and a very well known browser is Opera.
As a tribute I use Erik, firstname of the title character from Gaston Leroux's novel Le Fantôme de l'Opéra best known to English speakers as The Phantom of Opera.
My name is also Erik. So egotistical to call a project using its firstname isn't it.
My only justification is that I was playing Metal Gear Solid V and the creator Hideo Kojima name appears over 100 times in the game. Coincidentally the full name of the game is Metal Gear Solid V : The Phantom Pain.
License
The MIT License. See the LICENSE file for more information.