Skip to content
Snippets Groups Projects
Commit 70670e9e authored by Lukáš Panchartek's avatar Lukáš Panchartek
Browse files

selenium

parent f6383991
Branches master
No related tags found
No related merge requests found
......@@ -26,6 +26,11 @@
<version>4.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.19.1</version>
</dependency>
</dependencies>
......
package cz.cvut.fel.ts1.selenium;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Selenium {
public static void main(String[] args) throws InterruptedException {
WebDriver driver = new ChromeDriver();
driver.get("https://www.selenium.dev/selenium/web/web-form.html"); String title = driver.getTitle();
System.out.println(title);
WebElement text = driver.findElement(By.name("my-text"));
WebElement password = driver.findElement(By.name("my-password"));
WebElement submitButton = driver.findElement(By.cssSelector("button"));
text.sendKeys("Hello, Selenium!");
Thread.sleep(1000);
By.xpath("//input[@name='my-radio'][@value='radio-2']");
submitButton.click();
Thread.sleep(1000);
driver.quit();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment