BismiALLAH: fix-1

This commit is contained in:
2024-09-12 12:12:03 -04:00
commit d79b93317c
9 changed files with 145 additions and 0 deletions
@@ -0,0 +1,25 @@
package zacksolutions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.io.ByteArrayOutputStream;
public class GuestBookWebPage {
public static String title;
public static void main( String[] args ) {
}
public static void getTitle() throws InterruptedException {
//System.setProperty("web-driver.gecko.driver","/home/ilyes/mvnAction/SeleniumIntro/drivers/chromedriver");
System.setProperty("web-driver.gecko.driver","/home/ilyes/mvnAction/SeleniumIntro/drivers/geckodriver");
WebDriver driver = new FirefoxDriver();
//WebDriver driver = new ChromeDriver();
driver.get("https://zenful.cloud/");
title = driver.getTitle();
driver.findElement(By.id("message")).sendKeys("4 8 15 16 23 42");
driver.findElement(By.xpath("//button[normalize-space()='Add message']")).click();
Thread.sleep(3000);
driver.close();
}
}
@@ -0,0 +1,13 @@
package zacksolutions;
import org.junit.Assert;
import org.junit.Test;
public class TitleTest {
@Test
public void TestTitle() throws InterruptedException {
GuestBookWebPage.getTitle();
Assert.assertEquals("Guest Book", GuestBookWebPage.title);
System.out.println("The expected is: Guest Book and the actual is: " + GuestBookWebPage.title);
}
}