BismiALLAH: fix-1

This commit is contained in:
dadgam3er 2024-09-12 12:12:03 -04:00
commit d79b93317c
9 changed files with 145 additions and 0 deletions

38
.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

7
.idea/encodings.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

14
.idea/misc.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

BIN
drivers/chromedriver Executable file

Binary file not shown.

BIN
drivers/geckodriver Executable file

Binary file not shown.

45
pom.xml Normal file
View File

@ -0,0 +1,45 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>zacksolutions</groupId>
<artifactId>SeleniumIntro</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SeleniumIntro</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.24.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -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();
}
}

View File

@ -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);
}
}