Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 0 additions & 9 deletions .idea/libraries/commons_io_2_8_0.xml

This file was deleted.

9 changes: 9 additions & 0 deletions .idea/libraries/commons_io_2_8_0__1_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/libraries/lib.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/libraries/selenium_java_4_3.xml

This file was deleted.

4 changes: 2 additions & 2 deletions TrendYolProjectTest.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="testng" level="project" />
<orderEntry type="library" name="commons-io-2.8.0" level="project" />
<orderEntry type="library" name="selenium-java-4.3" level="project" />
<orderEntry type="library" name="lib" level="project" />
<orderEntry type="library" name="commons-io-2.8.0 (1)" level="project" />
<orderEntry type="library" name="selenium-java-4.3" level="project" />
</component>
</module>
Binary file modified out/production/TrendYolProjectTest/TestGruppen/Test1.class
Binary file not shown.
25 changes: 25 additions & 0 deletions src/TestGruppen/POMCodes_112.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package TestGruppen;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import java.util.List;

public class POMCodes_112 {

public POMCodes_112(WebDriver driver) {PageFactory.initElements(driver, this);}

@FindBy(xpath = "//button[text()='KABUL ET']")
public WebElement clickcokieaccept;

@FindBy(css = "[class='component-list component-small-list']")
public WebElement Allimagines;

@FindBy(xpath = "//*[@class='component-item']")
public List<WebElement> counttheelements;


}

44 changes: 41 additions & 3 deletions src/TestGruppen/Test1.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,54 @@
package TestGruppen;

import Utils.GenelWebDriver;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.asserts.SoftAssert;

public class Test1 extends GenelWebDriver {

@Test(priority = 1)
void test1() {

Actions actions=new Actions(GenelWebDriver.driver);
SoftAssert sft=new SoftAssert();

POMCodes_112 elements = new POMCodes_112(driver);
elements.clickcokieaccept.click();

System.out.println("sayısı="+elements.counttheelements.size());

actions.moveToElement(elements.Allimagines).build().perform();

for (int i = 0; i <elements.counttheelements.size(); i++) {
scrollToIntoMiddle(elements.counttheelements.get(i));
wait.until(ExpectedConditions.elementToBeClickable(elements.counttheelements.get(i)));
// wait.until(ExpectedConditions.visibilityOf(elements.counttheelements.get(i)));
actions.moveToElement(elements.counttheelements.get(i)).build().perform();
Assert.assertTrue(elements.Allimagines.getText().contains(elements.counttheelements.get(i).getText()));
System.out.println(elements.counttheelements.get(i).getText());

}
System.out.println("the test passed");



@Test
void test1(){
System.out.println("check 1 ");
}
public void scrollToIntoMiddle(WebElement element) {

JavascriptExecutor js = (JavascriptExecutor) driver;
String scrollElementIntoMiddle = "var viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);"
+ "var elementTop = arguments[0].getBoundingClientRect().top;"
+ "window.scrollBy(0, elementTop-(viewPortHeight/2));";
js.executeScript(scrollElementIntoMiddle, element);

}
}




3 changes: 0 additions & 3 deletions src/Utils/GenelWebDriver.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package Utils;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.support.ui.WebDriverWait;
Expand Down Expand Up @@ -38,7 +36,6 @@ public void BaslangicIslemleri() {
}



@AfterClass
public void BitisIslemleri(){
System.out.println("Driver stop ....");
Expand Down