WebDriver/src/WebDriver-Tests/WDElementTest.class.st

42 lines
975 B
Smalltalk
Raw Normal View History

2022-05-16 14:46:31 +00:00
"
A WDElementTest is a test class for testing the behavior of WDElement
"
Class {
#name : #WDElementTest,
#superclass : #TestCase,
#instVars : [
'driver'
],
#category : #'WebDriver-Tests-Base'
}
2023-04-25 15:19:00 +00:00
{ #category : #'tests - before' }
2022-05-16 14:46:31 +00:00
WDElementTest >> setUp [
super setUp.
driver := WebDriver start: #Firefox.
driver session.
]
2023-04-25 15:19:00 +00:00
{ #category : #'tests - after' }
2022-05-16 14:46:31 +00:00
WDElementTest >> tearDown [
driver deleteSession.
driver finalize.
super tearDown.
]
2022-05-16 16:09:02 +00:00
{ #category : #tests }
WDElementTest >> testAttributeReading [
| element |
2022-05-17 12:28:56 +00:00
driver url: 'https://ddg.co'.
element := driver findElement: '#logo_homepage_link' using: WDLocationStrategy cssSelector.
self assert: (element attribute: 'href') equals: '/about'.
]
{ #category : #tests }
WDElementTest >> testTextReading [
| element |
driver url: 'https://ddg.co'.
element := driver findElement: '#logo_homepage_link' using: WDLocationStrategy cssSelector.
self assert: (element text) equals: 'About DuckDuckGo'.
2022-05-16 16:09:02 +00:00
]