Capabilities support for Firefox
This commit is contained in:
parent
b894fdf757
commit
b6209258c1
|
@ -11,7 +11,7 @@ Class {
|
|||
#category : #WebDriver
|
||||
}
|
||||
|
||||
{ #category : #'as yet unclassified' }
|
||||
{ #category : #signaling }
|
||||
WDException class >> raise: errDict [
|
||||
"Initializes and populates the appropriate exception class."
|
||||
| error message stacktrace data |
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
"
|
||||
Navigation caused the user agent to hit a certificate warning, which is usually the result of an expired or invalid TLS certificate.
|
||||
"
|
||||
Class {
|
||||
#name : #WDInsecureCertificate,
|
||||
#superclass : #WDException,
|
||||
|
|
|
@ -6,7 +6,8 @@ Class {
|
|||
'server',
|
||||
'port',
|
||||
'sessionId',
|
||||
'parameters'
|
||||
'parameters',
|
||||
'optionsName'
|
||||
],
|
||||
#category : #WebDriver
|
||||
}
|
||||
|
@ -20,7 +21,8 @@ WebDriver class >> geckodriver [
|
|||
^ self new
|
||||
browser: subproc
|
||||
server: '127.0.0.1'
|
||||
port: 4444.
|
||||
port: 4444
|
||||
optionsName: #moz:firefoxOptions.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@ -29,7 +31,6 @@ WebDriver >> attribute: attr from: element [
|
|||
to: 'session/',sessionId,'/element/',element,'/attribute/',attr
|
||||
using: #GET)
|
||||
at: #value.
|
||||
|
||||
]
|
||||
|
||||
{ #category : #navigation }
|
||||
|
@ -44,6 +45,14 @@ WebDriver >> browser: brs server: srv port: portnum [
|
|||
port := portnum.
|
||||
]
|
||||
|
||||
{ #category : #initialization }
|
||||
WebDriver >> browser: brs server: srv port: portnum optionsName: optName [
|
||||
browser := brs.
|
||||
server := srv.
|
||||
port := portnum.
|
||||
optionsName := optName.
|
||||
]
|
||||
|
||||
{ #category : #finalization }
|
||||
WebDriver >> deleteSession [
|
||||
"Deletes the session."
|
||||
|
@ -85,6 +94,17 @@ WebDriver >> forward [
|
|||
self send: { } to: 'session/',sessionId,'/forward' using: #POST.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> property: attr from: element [
|
||||
|
||||
^ (self
|
||||
send: { }
|
||||
to:
|
||||
'session/' , sessionId , '/element/' , element , '/property/'
|
||||
, attr
|
||||
using: #GET) at: #value
|
||||
]
|
||||
|
||||
{ #category : #navigation }
|
||||
WebDriver >> refresh [
|
||||
self send: { } to: 'session/',sessionId,'/refresh' using: #POST.
|
||||
|
@ -103,8 +123,6 @@ WebDriver >> send: dict to: url using: method [
|
|||
method: method;
|
||||
contentReader: [ :entity |
|
||||
result := (NeoJSONReader on: (entity contents) readStream) propertyNamesAsSymbols: true; next.
|
||||
"(result at: #error ifPresent: [ true ] ifAbsent: [ false ])
|
||||
ifTrue: [ result := WDException raise: result ]"
|
||||
];
|
||||
execute.
|
||||
^result.
|
||||
|
@ -118,6 +136,27 @@ WebDriver >> session [
|
|||
^sessionId.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> session: capabilities [
|
||||
|
||||
sessionId ifNotNil: [ ^ self session ] ifNil: [
|
||||
sessionId := (self
|
||||
send: { #desiredCapabilities -> ({ optionsName -> ({#prefs -> capabilities}) asDictionary } asDictionary) }
|
||||
to: 'session'
|
||||
using: #POST) at: #value at: #sessionId.
|
||||
^ sessionId ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> source [
|
||||
|
||||
^ (self
|
||||
send: { }
|
||||
to:
|
||||
'session/' , sessionId , '/source'
|
||||
using: #GET) at: #value
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> status [
|
||||
^ (self send: { } to: 'status' using: #GET) at: #value.
|
||||
|
@ -133,6 +172,16 @@ WebDriver >> type: text into: element [
|
|||
self send: { #text -> text } to: 'session/',sessionId,'/element/',element,'/value' using: #POST.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> url [
|
||||
|
||||
^ (self
|
||||
send: { }
|
||||
to:
|
||||
'session/' , sessionId , '/url'
|
||||
using: #GET) at: #value
|
||||
]
|
||||
|
||||
{ #category : #navigation }
|
||||
WebDriver >> url: url [
|
||||
"Navigates the browser to the given URL."
|
||||
|
|
Loading…
Reference in New Issue