From 3fe7d16a0da9cb90821c51d439ea20e5ded89534 Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Tue, 25 Apr 2023 17:19:00 +0200 Subject: [PATCH] A few small bugfixes --- src/WebDriver-Tests/WDElementTest.class.st | 4 +- src/WebDriver/WDElement.class.st | 18 +---- src/WebDriver/WDTimeouts.class.st | 2 +- src/WebDriver/WebDriver.class.st | 80 ++++++++++++--------- src/WebDriver/WebDriverGeckodriver.class.st | 8 +-- 5 files changed, 55 insertions(+), 57 deletions(-) diff --git a/src/WebDriver-Tests/WDElementTest.class.st b/src/WebDriver-Tests/WDElementTest.class.st index 5df2610..e256f90 100644 --- a/src/WebDriver-Tests/WDElementTest.class.st +++ b/src/WebDriver-Tests/WDElementTest.class.st @@ -10,14 +10,14 @@ Class { #category : #'WebDriver-Tests-Base' } -{ #category : #running } +{ #category : #'tests - before' } WDElementTest >> setUp [ super setUp. driver := WebDriver start: #Firefox. driver session. ] -{ #category : #running } +{ #category : #'tests - after' } WDElementTest >> tearDown [ driver deleteSession. driver finalize. diff --git a/src/WebDriver/WDElement.class.st b/src/WebDriver/WDElement.class.st index ff817d0..534763b 100644 --- a/src/WebDriver/WDElement.class.st +++ b/src/WebDriver/WDElement.class.st @@ -2,25 +2,11 @@ I represent a DOM element. For the Responsibility part: Three sentences about my main responsibilities - what I do, what I know. - -For the Collaborators Part: State my main collaborators and one line about how I interact with them. - -Public API and Key Messages - -- message one -- message two -- (for bonus points) how to create instances. - - One simple example is simply gorgeous. -Internal Representation and Key Implementation Points. - Instance Variables - driver: - element: + driver: The active WebDriver from which this element was received + element: The actual WebDriver element - - Implementation Points " Class { #name : #WDElement, diff --git a/src/WebDriver/WDTimeouts.class.st b/src/WebDriver/WDTimeouts.class.st index 81eba13..9e72fc5 100644 --- a/src/WebDriver/WDTimeouts.class.st +++ b/src/WebDriver/WDTimeouts.class.st @@ -54,7 +54,7 @@ WDTimeouts >> pageLoad [ { #category : #accessing } WDTimeouts >> pageLoad: anObject [ - timeouts at: #pageLoad put: #anObject + timeouts at: #pageLoad put: anObject ] { #category : #accessing } diff --git a/src/WebDriver/WebDriver.class.st b/src/WebDriver/WebDriver.class.st index e96b1b4..b3a0aee 100644 --- a/src/WebDriver/WebDriver.class.st +++ b/src/WebDriver/WebDriver.class.st @@ -33,7 +33,6 @@ Class { 'server', 'port', 'sessionId', - 'prefs', 'capabilities' ], #category : #'WebDriver-Base' @@ -68,11 +67,6 @@ WebDriver class >> startWithOptions: options [ ^ self subclassResponsibility. ] -{ #category : #accessing } -WebDriver >> atPref: prefKey put: prefVal [ - prefs at: prefKey put: prefVal. -] - { #category : #navigation } WebDriver >> back [ @@ -163,36 +157,56 @@ WebDriver >> forward [ { #category : #'private - utilities' } WebDriver >> inspectionWebDriver [ + | presenter browserInfo | browserInfo := self browserDetails. - - presenter := SpBoxLayout newTopToBottom - add: (SpLabelPresenter new label: 'Connection Infos'; yourself) expand: false fill: false padding: 5; - add: (SpTablePresenter new - addColumn: (SpStringTableColumn title: 'Key' evaluated: [ :anObject | anObject at: #title ] ); - addColumn: (SpStringTableColumn title: 'Value' evaluated: [ :anObject | anObject at: #text ] ); - items: { - Dictionary new at: #title put: 'Browser'; at: #text put: (browserInfo at: #name); yourself. - Dictionary new at: #title put: 'Driver'; at: #text put: (browserInfo at: #driver); yourself. - Dictionary new at: #title put: 'Address'; at: #text put: ('http://{1}:{2}/' format: {server.port}); yourself. - }) - expand: true - fill: true - padding: 5; - add: (SpLabelPresenter new label: 'Preferences') expand: false fill: false padding: 5; - add: prefs asStringTreeTablePresenter - expand: true - fill: true - padding: 5; - add: (SpLabelPresenter new label: 'Session Capabilities') expand: false fill: false padding: 5; - add: capabilities asStringTreeTablePresenter - expand: true - fill: true - padding: 5 - yourself. - presenter := SpPresenter new layout: presenter; yourself. - ^ presenter. + + presenter := SpBoxLayout newTopToBottom + add: (SpLabelPresenter new + label: 'Connection Infos'; + yourself) + expand: false + fill: false + padding: 5; + add: (SpTablePresenter new + addColumn: (SpStringTableColumn + title: 'Key' + evaluated: [ :anObject | anObject at: #title ]); + addColumn: (SpStringTableColumn + title: 'Value' + evaluated: [ :anObject | anObject at: #text ]); + items: { + (Dictionary new + at: #title put: 'Browser'; + at: #text put: (browserInfo at: #name); + yourself). + (Dictionary new + at: #title put: 'Driver'; + at: #text put: (browserInfo at: #driver); + yourself). + (Dictionary new + at: #title put: 'Address'; + at: #text put: ('http://{1}:{2}/' format: { + server. + port }); + yourself) }) + expand: true + fill: true + padding: 5; + add: + (SpLabelPresenter new label: 'Session Capabilities') + expand: false + fill: false + padding: 5; + add: capabilities asStringTreeTablePresenter + expand: true + fill: true + padding: 5 yourself. + presenter := SpPresenter new + layout: presenter; + yourself. + ^ presenter ] { #category : #'private - utilities' } diff --git a/src/WebDriver/WebDriverGeckodriver.class.st b/src/WebDriver/WebDriverGeckodriver.class.st index e6a15ba..48dce20 100644 --- a/src/WebDriver/WebDriverGeckodriver.class.st +++ b/src/WebDriver/WebDriverGeckodriver.class.st @@ -36,15 +36,13 @@ WebDriverGeckodriver >> browserDetails [ { #category : #'private - utilities' } WebDriverGeckodriver >> constructCapabilities: caps [ - ^ { #desiredCapabilities - -> - ({ #moz:firefoxOptions -> ({ #prefs -> caps } asDictionary) } - asDictionary) } asDictionary. + capabilities := caps. + ^ { (#capabilities -> caps) } asDictionary ] { #category : #initialization } WebDriverGeckodriver >> initialize [ - prefs := Dictionary new. + ] { #category : #'private - utilities' }