More API implementation
This commit is contained in:
parent
9b741a904d
commit
5e5c47090e
|
@ -0,0 +1,70 @@
|
|||
"
|
||||
I am a helper class to define WebDriver timeouts.
|
||||
|
||||
The following timeouts are defined:
|
||||
|
||||
* `script:` defaults to 30'000, specifies when to interrupt a script that is being evaluated. A `nil` value implies that scripts should never be interrupted, but instead run indefinitely.
|
||||
* `pageLoad:` defaults to 300'000, provides the timeout limit used to interrupt an explicit navigation attempt.
|
||||
* `implicit:` defaults to 0, specifies a time to wait for the element location strategy to complete when locating an element.
|
||||
"
|
||||
Class {
|
||||
#name : #WDTimeouts,
|
||||
#superclass : #Object,
|
||||
#instVars : [
|
||||
'timeouts'
|
||||
],
|
||||
#category : #WebDriver
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
WDTimeouts >> extract [
|
||||
|
||||
^ timeouts
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WDTimeouts >> implicit [
|
||||
|
||||
^ timeouts at: #implicit
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WDTimeouts >> implicit: anObject [
|
||||
|
||||
timeouts at: #implicit put: anObject
|
||||
]
|
||||
|
||||
{ #category : #initialization }
|
||||
WDTimeouts >> initialize [
|
||||
| dict |
|
||||
dict := Dictionary new.
|
||||
dict
|
||||
at: #script put: 30000;
|
||||
at: #pageLoad put: 300000;
|
||||
at: #implicit put: 0.
|
||||
timeouts := dict.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WDTimeouts >> pageLoad [
|
||||
|
||||
^ timeouts at: #pageLoad.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WDTimeouts >> pageLoad: anObject [
|
||||
|
||||
timeouts at: #pageLoad put: #anObject
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WDTimeouts >> script [
|
||||
|
||||
^ timeouts at: #script.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WDTimeouts >> script: anObject [
|
||||
|
||||
timeouts at: #script put: anObject.
|
||||
]
|
|
@ -168,7 +168,7 @@ WebDriver >> refresh [
|
|||
self send: { } to: 'session/' , sessionId , '/refresh' using: #POST
|
||||
]
|
||||
|
||||
{ #category : #navigation }
|
||||
{ #category : #'private - utilities' }
|
||||
WebDriver >> send: dict to: url using: method [
|
||||
^ self subclassResponsibility.
|
||||
]
|
||||
|
@ -213,6 +213,25 @@ WebDriver >> status [
|
|||
^ self send: { } to: 'status' using: #GET
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> timeouts [
|
||||
| toutdata |
|
||||
toutdata := self send: { } to: 'session/',sessionId,'/timeouts' using: #GET.
|
||||
^ WDTimeouts new
|
||||
script: (toutdata at: #script);
|
||||
pageLoad: (toutdata at: #pageLoad);
|
||||
implicit: (toutdata at: #implicit).
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> timeouts: timeouts [
|
||||
|
||||
self
|
||||
send: timeouts extract
|
||||
to: 'session/' , sessionId , 'timeouts'
|
||||
using: #POST
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
WebDriver >> title [
|
||||
|
||||
|
|
Loading…
Reference in New Issue