WebDriver/src/WebDriver/WebDriverGeckodriver.class.st

60 lines
1.4 KiB
Smalltalk
Raw Normal View History

2022-04-27 00:48:41 +00:00
"
I implement the specifics and quirks to remote control a Firefox instance using Geckodriver.
"
Class {
#name : #WebDriverGeckodriver,
#superclass : #WebDriver,
2022-05-17 12:28:56 +00:00
#category : #'WebDriver-Base'
2022-04-27 00:48:41 +00:00
}
2022-05-11 21:28:04 +00:00
{ #category : #testing }
WebDriverGeckodriver class >> matchesBrowserType: browserType [
^ browserType = #Firefox
]
{ #category : #'instance creation' }
WebDriverGeckodriver class >> startWithOptions: options [
| subproc |
subproc := OSSUnixSubprocess new
command: 'geckodriver'.
[ subproc run ] fork.
2022-05-17 12:28:56 +00:00
(Delay forSeconds: 0.1) wait.
2022-05-11 21:28:04 +00:00
^ self new
browser: subproc
server: '127.0.0.1'
port: 4444.
]
2022-05-17 18:50:10 +00:00
{ #category : #'private - utilities' }
WebDriverGeckodriver >> browserDetails [
^ Dictionary new
at: #name put: 'Firefox';
at: #driver put: 'Geckodriver';
yourself.
]
2022-04-27 00:48:41 +00:00
{ #category : #'private - utilities' }
WebDriverGeckodriver >> constructCapabilities: caps [
2023-04-25 15:19:00 +00:00
capabilities := caps.
^ { (#capabilities -> caps) } asDictionary
2022-04-27 00:48:41 +00:00
]
2022-04-27 14:04:26 +00:00
{ #category : #initialization }
WebDriverGeckodriver >> initialize [
2023-04-25 15:19:00 +00:00
2022-04-27 14:04:26 +00:00
]
2022-05-16 13:17:04 +00:00
{ #category : #'private - utilities' }
WebDriverGeckodriver >> postprocessResult: result [
2022-05-16 14:46:31 +00:00
| actualResult |
actualResult := result isDictionary
ifTrue: [
(result includesKey: #value)
ifTrue: [ result at: #value ]
ifFalse: [ result ] ]
ifFalse: [ result ].
^ actualResult
2022-04-27 00:48:41 +00:00
]