Second commit

This commit is contained in:
aissel 2023-10-05 10:53:50 +05:30
parent b4bf3e08ad
commit 961b82bb86
9 changed files with 226 additions and 160 deletions

207
pom.xml
View File

@ -1,20 +1,22 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
<modelVersion>4.0.0</modelVersion> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<groupId>DCIM_Counts_Check</groupId> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>DCIM_Counts_Check</artifactId> <modelVersion>4.0.0</modelVersion>
<version>0.0.1-SNAPSHOT</version> <groupId>DCIM_Counts_Check</groupId>
<artifactId>DCIM_Counts_Check</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>DCIM_Counts_Check</name>
<url>http://maven.apache.org</url>
<name>DCIM_Counts_Check</name>
<properties> <url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<junit.jupiter.version>5.6.0</junit.jupiter.version> <junit.jupiter.version>5.6.0</junit.jupiter.version>
<maven.compiler.release>11</maven.compiler.release> <maven.compiler.release>11</maven.compiler.release>
<project.build.testSourceDirectory>src/test/java</project.build.testSourceDirectory> <project.build.testSourceDirectory>src/test/java</project.build.testSourceDirectory>
</properties> </properties>
<repositories> <repositories>
@ -25,32 +27,26 @@
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <!-- Other dependencies -->
<dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.11</version> <version>4.12</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.5.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>5.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> <dependency>
<dependency> <groupId>io.cucumber</groupId>
<groupId>org.apache.poi</groupId> <artifactId>gherkin</artifactId>
<artifactId>poi-ooxml</artifactId> <version>5.1.0</version>
<version>3.9</version> </dependency>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api --> <!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->
<dependency> <dependency>
@ -59,25 +55,26 @@
<version>1.5.5</version> <version>1.5.5</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.4</version> <version>3.4</version>
</dependency> </dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.5.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.5.3</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>com.sun.mail</groupId> <groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId> <artifactId>javax.mail</artifactId>
<version>1.6.2</version> <version>1.6.2</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.github.ralfstuckert.pdfbox-layout/pdfbox2-layout --> <!--
https://mvnrepository.com/artifact/com.github.ralfstuckert.pdfbox-layout/pdfbox2-layout -->
<dependency> <dependency>
<groupId>com.github.ralfstuckert.pdfbox-layout</groupId> <groupId>com.github.ralfstuckert.pdfbox-layout</groupId>
<artifactId>pdfbox2-layout</artifactId> <artifactId>pdfbox2-layout</artifactId>
@ -85,7 +82,6 @@
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng --> <!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
@ -116,25 +112,26 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer --> <!--
<dependency> https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
<groupId>io.cucumber</groupId> <dependency>
<artifactId>cucumber-picocontainer</artifactId> <groupId>io.cucumber</groupId>
<version>4.8.1</version> <artifactId>cucumber-picocontainer</artifactId>
<scope>test</scope> <version>4.8.1</version>
</dependency> <scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core --> <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency> <dependency>
<groupId>io.cucumber</groupId> <groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId> <artifactId>cucumber-core</artifactId>
<version>4.8.1</version> <version>4.8.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!--
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency> <dependency>
<groupId>org.seleniumhq.selenium</groupId> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId> <artifactId>selenium-java</artifactId>
@ -142,7 +139,8 @@
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports-cucumber4-adapter --> <!--
https://mvnrepository.com/artifact/com.aventstack/extentreports-cucumber4-adapter -->
<dependency> <dependency>
<groupId>com.aventstack</groupId> <groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId> <artifactId>extentreports-cucumber4-adapter</artifactId>
@ -167,47 +165,48 @@
<version>2.3.30</version> <version>2.3.30</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api --> <!--
<dependency> https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
<groupId>org.apache.maven</groupId> <dependency>
<artifactId>maven-plugin-api</artifactId> <groupId>org.apache.maven</groupId>
<version>3.8.3</version> <artifactId>maven-plugin-api</artifactId>
</dependency> <version>3.8.3</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<verbose>true</verbose> <verbose>true</verbose>
<fork>true</fork> <fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_202\bin\javac</executable> <executable>C:\Program Files\Java\jdk1.8.0_202\bin\javac</executable>
<compilerVersion>1.3</compilerVersion> <compilerVersion>1.3</compilerVersion>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version> <version>2.18.1</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.maven.surefire</groupId> <groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId> <artifactId>surefire-junit47</artifactId>
<version>2.18.1</version> <version>2.18.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
<inherited>true</inherited> <inherited>true</inherited>
<configuration> <configuration>
<suiteXmlFiles> <suiteXmlFiles>
<suiteXmlFile>/home/aissel/git2/DCIM_Counts_Check/testng.xml</suiteXmlFile> <suiteXmlFile>/home/aissel/git4/testng.xml</suiteXmlFile>
</suiteXmlFiles> </suiteXmlFiles>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -5,11 +5,14 @@ import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import Utilities.ConfigReader; import Utilities.ConfigReader;
import io.github.bonigarcia.wdm.WebDriverManager; import io.github.bonigarcia.wdm.WebDriverManager;
public class Contacts_Count public class Contacts_Count
{ {
@Test
public static void main(String[] args) throws InterruptedException public static void main(String[] args) throws InterruptedException
{ {
WebDriverManager.chromedriver().setup(); WebDriverManager.chromedriver().setup();
@ -40,7 +43,7 @@ public class Contacts_Count
System.out.println("Contacts: " + text); System.out.println("Contacts: " + text);
Thread.sleep(3000); Thread.sleep(3000);
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click(); driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//body[1]/div[74]/div[2]/div[1]/div[1]/a[1]/div[1]/table[1]/tbody[1]/tr[1]/td[2]/a[1]")).click(); driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000); Thread.sleep(3000);
} }
driver.quit(); driver.quit();

View File

@ -9,6 +9,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.testng.internal.BaseClassFinder; import org.testng.internal.BaseClassFinder;
import Utilities.ConfigReader; import Utilities.ConfigReader;
@ -17,16 +18,15 @@ import io.github.bonigarcia.wdm.WebDriverManager;
public class Discover_Count public class Discover_Count
{ {
String path = System.getProperty("user.dir"); @Test
public static void main(String[] args) throws InterruptedException public static void main(String[] args) throws InterruptedException
{ {
WebDriverManager.chromedriver().setup(); WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver(); WebDriver driver = new ChromeDriver();
ConfigReader config = new ConfigReader(); ConfigReader config = new ConfigReader();
// Define the sets you want to use // Define the sets you want to use
//String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"}; String[] sets = {"set1", "set2", "set4", "set5", "set6", "set7"};
String[] sets = {"set1", "set4", "set5", "set6", "set7"}; //String[] sets = {"set1", "set4", "set5", "set6", "set7"};
Thread.sleep(10000); Thread.sleep(10000);
for (String set : sets) { for (String set : sets) {
Thread.sleep(10000); Thread.sleep(10000);
@ -46,12 +46,23 @@ public class Discover_Count
Thread.sleep(5000); Thread.sleep(5000);
WebDriverWait wait = new WebDriverWait(driver, 60); WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[normalize-space()='Reset']"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[normalize-space()='Reset']")));
//wait.until(ExpectedConditions.titleContains("kolsByRankingPager_left"));
//JavascriptExecutor jse = (JavascriptExecutor) driver; String text= driver.findElement(By.xpath("//div[@class='ui-paging-info']")).getText();
//jse.executeScript("window.scrollTo(0,document.body.scrollHeight)"); System.out.println("Total Discover count: " + text);
Thread.sleep(3000);
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000);
}
driver.quit();
//driver.findElement(By.xpath("//span[@class='ui-icon ui-icon-seek-end']")).click(); }
try { }
/* try {
int totalRowCount = 0; int totalRowCount = 0;
boolean hasNextPage = true; boolean hasNextPage = true;
@ -92,6 +103,6 @@ public class Discover_Count
driver.quit(); driver.quit();
} }
} } */

View File

@ -10,6 +10,7 @@ import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Wait; import org.openqa.selenium.support.ui.Wait;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
@ -19,9 +20,10 @@ import org.openqa.selenium.support.ui.ExpectedConditions;
import Utilities.ConfigReader; import Utilities.ConfigReader;
import Utilities.readConfigFile; import Utilities.readConfigFile;
import io.github.bonigarcia.wdm.WebDriverManager; import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Interaction_Count public class Track_Interaction_Count
{ {
@Test
public static void main(String[] args) throws InterruptedException public static void main(String[] args) throws InterruptedException
{ {
WebDriverManager.chromedriver().setup(); WebDriverManager.chromedriver().setup();
@ -29,7 +31,7 @@ public class Track_Interaction_Count
ConfigReader config = new ConfigReader(); ConfigReader config = new ConfigReader();
// Define the sets you want to use // Define the sets you want to use
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"}; String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
Thread.sleep(10000); Thread.sleep(10000);
for (String set : sets) { for (String set : sets) {
Thread.sleep(10000); Thread.sleep(10000);
@ -52,11 +54,34 @@ public class Track_Interaction_Count
driver.findElement(By.xpath("//div[@id='resetBttn']")).click(); driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
Thread.sleep(3000); Thread.sleep(3000);
WebDriverWait wait = new WebDriverWait(driver, 10); WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']")));
try { String text= driver.findElement(By.xpath("//div[@class='ui-paging-info']")).getText();
System.out.println("Total Interactions count: " + text);
Thread.sleep(3000);
} catch (NoSuchElementException e) {
// Handle the exception here (e.g., log, report, or take screenshots)
System.out.println("Element not found: " + e.getMessage());
}
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000);
}
driver.quit();
}
}
/*try {
int totalRowCount = 0; int totalRowCount = 0;
boolean hasNextPage = true; boolean hasNextPage = true;
@ -91,7 +116,7 @@ public class Track_Interaction_Count
// Handle the exception here (e.g., log, report, or take screenshots) // Handle the exception here (e.g., log, report, or take screenshots)
System.out.println("Element not found: " + e.getMessage()); System.out.println("Element not found: " + e.getMessage());
} }
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click(); driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click(); driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000); Thread.sleep(3000);
@ -99,5 +124,5 @@ public class Track_Interaction_Count
} }
driver.quit(); driver.quit();
} }
} }*/

View File

@ -11,20 +11,22 @@ import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import Utilities.ConfigReader; import Utilities.ConfigReader;
import Utilities.readConfigFile; import Utilities.readConfigFile;
import io.github.bonigarcia.wdm.WebDriverManager; import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Interaction_Export public class Track_Interaction_Export
{ {
@Test
public static void main(String[] args) throws InterruptedException public static void main(String[] args) throws InterruptedException
{ {
ChromeOptions options = new ChromeOptions(); ChromeOptions options = new ChromeOptions();
// Set the download directory // Set the download directory
options.addArguments("download.default_directory=/home/aissel/git4"); options.addArguments("download.default_directory=" +System.getProperty("user.dir"));
// Disable the download prompt // Disable the download prompt
options.setExperimentalOption("prefs", options.setExperimentalOption("prefs",
ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true)); ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true));
@ -64,7 +66,8 @@ public class Track_Interaction_Export
WebDriverWait wait = new WebDriverWait(driver, 30); WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@data-original-title='Export Interaction Detail into Excel format']"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@data-original-title='Export Interaction Detail into Excel format']")));
File downloadedFile = new File("/home/aissel/Git2/DICM_Count/exported_file.xlsx"); //File downloadedFile = new File("/home/aissel/git4/exported_file.xlsx");
File downloadedFile = new File(System.getProperty("user.dir")+"/exported_file.xlsx");
if (downloadedFile.exists()) { if (downloadedFile.exists()) {
System.out.println("Downloaded file exists."); System.out.println("Downloaded file exists.");
} else { } else {

View File

@ -12,6 +12,7 @@ import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -20,12 +21,14 @@ import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Medinsght_Export public class Track_Medinsght_Export
{ {
@Test
public static void main(String[] args) throws InterruptedException public static void main(String[] args) throws InterruptedException
{ {
ChromeOptions options = new ChromeOptions(); ChromeOptions options = new ChromeOptions();
// Set the download directory // Set the download directory
options.addArguments("download.default_directory=/home/aissel/git4"); //options.addArguments("download.default_directory=/home/aissel/git4");
options.addArguments("download.default_directory=" +System.getProperty("user.dir"));
// Disable the download prompt // Disable the download prompt
options.setExperimentalOption("prefs", options.setExperimentalOption("prefs",
ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true)); ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true));
@ -66,7 +69,7 @@ public class Track_Medinsght_Export
WebDriverWait wait = new WebDriverWait(driver, 30); WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='excelExportIcon sprite_iconSet tooltip-demo tooltop-left']"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='excelExportIcon sprite_iconSet tooltip-demo tooltop-left']")));
File downloadedFile = new File("/home/aissel/Git2/DICM_Count/exported_file.xlsx"); File downloadedFile = new File(System.getProperty("user.dir")+"/exported_file.xlsx");
if (downloadedFile.exists()) { if (downloadedFile.exists()) {
System.out.println("Downloaded file exists."); System.out.println("Downloaded file exists.");
} else { } else {

View File

@ -10,20 +10,22 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import Utilities.ConfigReader; import Utilities.ConfigReader;
import Utilities.readConfigFile; import Utilities.readConfigFile;
import io.github.bonigarcia.wdm.WebDriverManager; import io.github.bonigarcia.wdm.WebDriverManager;
public class Track_Medinsight_Count public class Track_Medinsight_Count
{ {
@Test
public static void main(String[] args) throws InterruptedException public static void main(String[] args) throws InterruptedException
{ {
WebDriverManager.chromedriver().setup(); WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver(); WebDriver driver = new ChromeDriver();
ConfigReader config = new ConfigReader(); ConfigReader config = new ConfigReader();
// Define the sets you want to use // Define the sets you want to use
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6"}; String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
//String[] sets = {"set"}; //String[] sets = {"set"};
Thread.sleep(10000); Thread.sleep(10000);
for (String set : sets) { for (String set : sets) {
@ -44,14 +46,34 @@ public class Track_Medinsight_Count
element.click(); element.click();
Thread.sleep(3000); Thread.sleep(3000);
//driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click(); //driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click();
driver.findElement(By.xpath("//label[@for='medical_insight']")).click(); driver.findElement(By.xpath("//label[@for='medical_insight']")).click();
driver.findElement(By.xpath("//div[@id='resetBttn']")).click(); driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
Thread.sleep(3000); Thread.sleep(3000);
WebDriverWait wait = new WebDriverWait(driver, 10); WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']")));
try { String text= driver.findElement(By.xpath("//div[@class='ui-paging-info']")).getText();
System.out.println("Total MedInsight count: " + text);
Thread.sleep(3000);
} catch (NoSuchElementException e) {
// Handle the exception here (e.g., log, report, or take screenshots)
System.out.println("Element not found: " + e.getMessage());
}
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000);
}
driver.quit();
}
}
/*try {
int totalRowCount = 0; int totalRowCount = 0;
boolean hasNextPage = true; boolean hasNextPage = true;
@ -86,7 +108,7 @@ public class Track_Medinsight_Count
// Handle the exception here (e.g., log, report, or take screenshots) // Handle the exception here (e.g., log, report, or take screenshots)
System.out.println("Element not found: " + e.getMessage()); System.out.println("Element not found: " + e.getMessage());
} }
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click(); driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click(); driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
Thread.sleep(3000); Thread.sleep(3000);
@ -94,10 +116,10 @@ public class Track_Medinsight_Count
} }
driver.quit(); driver.quit();
} }
} } */

View File

@ -4,26 +4,26 @@ import java.io.IOException;
import java.util.Properties; import java.util.Properties;
public class ConfigReader public class ConfigReader
{ {
private Properties properties; private Properties properties;
public ConfigReader() { public ConfigReader() {
properties = new Properties(); properties = new Properties();
try { try {
FileInputStream fis = new FileInputStream("/home/aissel/git4/src/test/resources/browser-config.properties"); FileInputStream fis = new FileInputStream(System.getProperty("user.dir")+"/src/test/resources/browser-config.properties");
properties.load(fis); properties.load(fis);
fis.close(); fis.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
public String getProperty(String setName, String key) { public String getProperty(String setName, String key) {
// Combine the set name and key to get the property // Combine the set name and key to get the property
return properties.getProperty(setName + "." + key); return properties.getProperty(setName + "." + key);
} }
} }

View File

@ -3,7 +3,7 @@
<suite name="Suite"> <suite name="Suite">
<test thread-count="5" name="Test" junit="true"> <test thread-count="5" name="Test" junit="true">
<classes> <classes>
<class name="StepDefinitions.testRunnerTest"/> <class name="test.Contacts_Count"/>
</classes> </classes>
</test> <!-- Test --> </test> <!-- Test -->
</suite> <!-- Suite --> </suite> <!-- Suite -->