WebDriver/src/WebDriver/WDElement.class.st

98 lines
1.6 KiB
Smalltalk

"
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: <Object>
element: <Object>
Implementation Points
"
Class {
#name : #WDElement,
#superclass : #Object,
#instVars : [
'driver',
'element'
],
#category : #'WebDriver-Base'
}
{ #category : #accessing }
WDElement >> attribute: attr [
^ self driver
sendWithSession: { }
to:
'element/' , element , '/attribute/'
, attr
using: #GET
]
{ #category : #simulating }
WDElement >> click [
self driver
sendWithSession: { }
to: 'element/' , element , '/click'
using: #POST
]
{ #category : #accessing }
WDElement >> driver [
^ driver
]
{ #category : #accessing }
WDElement >> driver: anObject [
driver := anObject
]
{ #category : #accessing }
WDElement >> element [
^ element
]
{ #category : #accessing }
WDElement >> element: anObject [
element := anObject
]
{ #category : #accessing }
WDElement >> property: attr [
^ self driver
sendWithSession: { }
to:
'element/' , element , '/property/'
, attr
using: #GET
]
{ #category : #simulating }
WDElement >> type: text [
self driver
sendWithSession: { (#text -> text) }
to: 'element/' , element , '/value'
using: #POST
]