diff --git a/Kelompok 1/LatihanSeleniumTest.java b/Kelompok 1/LatihanSeleniumTest.java new file mode 100644 index 0000000..4b38f74 --- /dev/null +++ b/Kelompok 1/LatihanSeleniumTest.java @@ -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 vars; + JavascriptExecutor js; + @Before + public void setUp() { + driver = new ChromeDriver(); + js = (JavascriptExecutor) driver; + vars = new HashMap(); + } + @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(); + } +}