36 lines
876 B
Smalltalk
36 lines
876 B
Smalltalk
"
|
|
I implement the specifics and quirks to remote control a Firefox instance using Geckodriver.
|
|
"
|
|
Class {
|
|
#name : #WebDriverGeckodriver,
|
|
#superclass : #WebDriver,
|
|
#category : #WebDriver
|
|
}
|
|
|
|
{ #category : #'private - utilities' }
|
|
WebDriverGeckodriver >> constructCapabilities: caps [
|
|
|
|
^ { #desiredCapabilities
|
|
->
|
|
({ #moz:firefoxOptions -> ({ #prefs -> caps } asDictionary) }
|
|
asDictionary) } asDictionary.
|
|
]
|
|
|
|
{ #category : #navigation }
|
|
WebDriverGeckodriver >> send: dict to: url using: method [
|
|
|result|
|
|
result := nil.
|
|
ZnClient new
|
|
host: server;
|
|
port: port;
|
|
path: url;
|
|
contents: (NeoJSONWriter toString: dict asDictionary);
|
|
contentType: ZnMimeType applicationJson;
|
|
method: method;
|
|
contentReader: [ :entity |
|
|
result := (NeoJSONReader on: (entity contents) readStream) propertyNamesAsSymbols: true; next.
|
|
];
|
|
execute.
|
|
^result at: #value.
|
|
]
|