File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
examples/kotlin/src/test/kotlin/dev/selenium/getting_started Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ package dev.selenium.getting_started
2+
3+ import org.junit.jupiter.api.*
4+ import org.junit.jupiter.api.Assertions.assertEquals
5+ import org.openqa.selenium.By
6+ import org.openqa.selenium.WebDriver
7+ import org.openqa.selenium.chrome.ChromeDriver
8+ import java.time.Duration
9+
10+ @TestInstance(TestInstance .Lifecycle .PER_CLASS )
11+ class UsingSeleniumTest {
12+ private lateinit var driver: WebDriver
13+
14+ @BeforeEach
15+ fun setup () {
16+ driver = ChromeDriver ()
17+ }
18+
19+ @Test
20+ fun eightComponents () {
21+ driver.get(" https://www.selenium.dev/selenium/web/web-form.html" )
22+
23+ val title = driver.title
24+ assertEquals(" Web form" , title)
25+
26+ driver.manage().timeouts().implicitlyWait(Duration .ofMillis(500 ))
27+
28+ val textBox = driver.findElement(By .name(" my-text" ))
29+ val submitButton = driver.findElement(By .cssSelector(" button" ))
30+
31+ textBox.sendKeys(" Selenium" )
32+ submitButton.click()
33+
34+ val message = driver.findElement(By .id(" message" ))
35+ val value = message.text
36+ assertEquals(" Received!" , value)
37+ }
38+
39+ @AfterEach
40+ fun teardown () {
41+ driver.quit()
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments