Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Kelompok 1/LatihanSeleniumTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Generated by Selenium IDE
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsNot.not;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import java.util.*;
import java.net.MalformedURLException;
import java.net.URL;
public class LatihanSeleniumTest {
private WebDriver driver;
private Map<String, Object> vars;
JavascriptExecutor js;
@Before
public void setUp() {
driver = new ChromeDriver();
js = (JavascriptExecutor) driver;
vars = new HashMap<String, Object>();
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void latihanSelenium() {
driver.get("https://seleniumbase.io/demo_page");
driver.manage().window().setSize(new Dimension(1440, 790));
driver.findElement(By.id("myTextarea")).click();

// Mengubah Textarea dengan mengisi "Hello"
driver.findElement(By.id("myTextarea")).sendKeys("Hello");

// Melakukan perubahan dengan meng-click button untuk mengubah warna
driver.findElement(By.id("myButton")).click();

// Melakukan perubahan dengan memilih RadioButton2
driver.findElement(By.id("radioButton2")).click();

// Melakukan perubahan dengan memilih dropdown menjadi set to 75%
driver.findElement(By.id("mySelect")).click();
{
WebElement dropdown = driver.findElement(By.id("mySelect"));
dropdown.findElement(By.xpath("//option[. = 'Set to 75%']")).click();
}
driver.findElement(By.cssSelector("body")).click();
}
}