WebDriver/src/WebDriver/WebDriverGeckodriver.class.st

41 lines
974 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 : #initialization }
WebDriverGeckodriver >> initialize [
prefs := Dictionary new.
]
{ #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.
]