Increased flexibility

This commit is contained in:
Daniel Ziltener 2022-05-11 23:28:04 +02:00
parent 5e5c47090e
commit ae6c229e31
3 changed files with 44 additions and 10 deletions

View File

@ -13,7 +13,7 @@ Class {
{ #category : #running }
WebDriverTest >> setUp [
super setUp.
webdriver := WebDriver geckodriver.
webdriver := WebDriver start: #Firefox.
webdriver session.
]

View File

@ -42,16 +42,33 @@ Class {
#category : #WebDriver
}
{ #category : #testing }
WebDriver class >> matchesBrowserType: browserType [
^ self subclassResponsibility.
]
{ #category : #accessing }
WebDriver class >> start: browserType [
| emptyOpts |
emptyOpts := Dictionary new.
^ self start: browserType with: emptyOpts.
]
{ #category : #'instance creation' }
WebDriver class >> geckodriver [
| subproc |
subproc := OSSUnixSubprocess new
command: 'geckodriver'.
[ subproc run ] fork.
^ WebDriverGeckodriver new
browser: subproc
server: '127.0.0.1'
port: 4444.
WebDriver class >> start: browserType with: options [
"comment stating purpose of class-side method"
"scope: class-variables & class-instance-variables"
| matchingClass |
matchingClass := self subclasses
detect: [ :operationClass | operationClass matchesBrowserType: browserType ]
ifNone: [ self ].
^ matchingClass startWithOptions: options.
]
{ #category : #'instance creation' }
WebDriver class >> startWithOptions: options [
^ self subclassResponsibility.
]
{ #category : #accessing }

View File

@ -7,6 +7,23 @@ Class {
#category : #WebDriver
}
{ #category : #testing }
WebDriverGeckodriver class >> matchesBrowserType: browserType [
^ browserType = #Firefox
]
{ #category : #'instance creation' }
WebDriverGeckodriver class >> startWithOptions: options [
| subproc |
subproc := OSSUnixSubprocess new
command: 'geckodriver'.
[ subproc run ] fork.
^ self new
browser: subproc
server: '127.0.0.1'
port: 4444.
]
{ #category : #'private - utilities' }
WebDriverGeckodriver >> constructCapabilities: caps [