This commit is contained in:
Daniel Ziltener 2022-05-21 18:47:21 +02:00
parent 2cc08210f4
commit 05b5ee8a1b
2 changed files with 54 additions and 0 deletions

View File

@ -113,6 +113,36 @@ WDElement >> element: anObject [
element := anObject
]
{ #category : #accessing }
WDElement >> findElement: elemSelector using: locStrategy [
| reply |
reply := driver
sendWithSession: {
(#using -> locStrategy).
(#value -> elemSelector)
}
to: 'element/' , element , '/element'
using: #POST.
^ self class new
driver: driver;
element: reply values first.
]
{ #category : #accessing }
WDElement >> findElements: elemSelector using: locStrategy [
| reply |
reply := driver
sendWithSession: {
(#using -> locStrategy).
(#value -> elemSelector)
}
to: 'element/' , element , '/elements'
using: #POST.
^ reply collect: [ :elem | self class new driver: driver; element: elem values first. ]
]
{ #category : #'private - utilities' }
WDElement >> inspectionWDElement [
<inspectorPresentationOrder: 10 title: 'DOM Element'>

View File

@ -106,6 +106,20 @@ WebDriver >> deleteSession [
self send: { } to: 'session/' , sessionId using: #DELETE
]
{ #category : #simulating }
WebDriver >> executeAsync: script with: args [
^ self sendWithSession: { #script -> script . #args -> args }
to: 'execute/async'
using: #POST.
]
{ #category : #simulating }
WebDriver >> executeSync: script with: args [
^ self sendWithSession: { #script -> script . #args -> args }
to: 'execute/sync'
using: #POST.
]
{ #category : #finalization }
WebDriver >> finalize [
@ -186,12 +200,22 @@ WebDriver >> postprocessResult: result [
^ result.
]
{ #category : #utilities }
WebDriver >> print [
^ self sendWithSession: { } to: 'print' using: #POST.
]
{ #category : #navigation }
WebDriver >> refresh [
self send: { } to: 'session/' , sessionId , '/refresh' using: #POST
]
{ #category : #accessing }
WebDriver >> screenshot [
^ (self sendWithSession: '' to: 'screenshot' using: #GET) base64Decoded.
]
{ #category : #'private - utilities' }
WebDriver >> send: dict to: url using: method [
|result|