Increased flexibility
This commit is contained in:
parent
5e5c47090e
commit
ae6c229e31
|
@ -13,7 +13,7 @@ Class {
|
|||
{ #category : #running }
|
||||
WebDriverTest >> setUp [
|
||||
super setUp.
|
||||
webdriver := WebDriver geckodriver.
|
||||
webdriver := WebDriver start: #Firefox.
|
||||
webdriver session.
|
||||
]
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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 [
|
||||
|
||||
|
|
Loading…
Reference in New Issue