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 } { #category : #running }
WebDriverTest >> setUp [ WebDriverTest >> setUp [
super setUp. super setUp.
webdriver := WebDriver geckodriver. webdriver := WebDriver start: #Firefox.
webdriver session. webdriver session.
] ]

View File

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

View File

@ -7,6 +7,23 @@ Class {
#category : #WebDriver #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' } { #category : #'private - utilities' }
WebDriverGeckodriver >> constructCapabilities: caps [ WebDriverGeckodriver >> constructCapabilities: caps [