First commit
This commit is contained in:
commit
b4bf3e08ad
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1 @@
|
|||
/target/
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>DCIM_Counts_Check</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,6 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
|
@ -0,0 +1,8 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
|
@ -0,0 +1,4 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,213 @@
|
|||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<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>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<junit.jupiter.version>5.6.0</junit.jupiter.version>
|
||||
<maven.compiler.release>11</maven.compiler.release>
|
||||
<project.build.testSourceDirectory>src/test/java</project.build.testSourceDirectory>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</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>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>javax.mail-api</artifactId>
|
||||
<version>1.5.5</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.bonigarcia</groupId>
|
||||
<artifactId>webdrivermanager</artifactId>
|
||||
<version>5.5.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.github.ralfstuckert.pdfbox-layout/pdfbox2-layout -->
|
||||
<dependency>
|
||||
<groupId>com.github.ralfstuckert.pdfbox-layout</groupId>
|
||||
<artifactId>pdfbox2-layout</artifactId>
|
||||
<version>0.8.6</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>6.14.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.apple</groupId>
|
||||
<artifactId>AppleJavaExtensions</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java8 -->
|
||||
<dependency>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-java8</artifactId>
|
||||
<version>4.8.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
|
||||
<dependency>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-junit</artifactId>
|
||||
<version>4.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
|
||||
<dependency>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-picocontainer</artifactId>
|
||||
<version>4.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
|
||||
<dependency>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-core</artifactId>
|
||||
<version>4.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>3.141.59</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports-cucumber4-adapter -->
|
||||
<dependency>
|
||||
<groupId>com.aventstack</groupId>
|
||||
<artifactId>extentreports-cucumber4-adapter</artifactId>
|
||||
<version>1.0.12</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-java</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>io.cucumber</groupId>
|
||||
<artifactId>cucumber-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
<groupId>org.freemarker</groupId>
|
||||
|
||||
<artifactId>freemarker</artifactId>
|
||||
|
||||
<version>2.3.30</version>
|
||||
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven/maven-plugin-api -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>3.8.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<verbose>true</verbose>
|
||||
<fork>true</fork>
|
||||
<executable>C:\Program Files\Java\jdk1.8.0_202\bin\javac</executable>
|
||||
<compilerVersion>1.3</compilerVersion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18.1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>2.18.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<inherited>true</inherited>
|
||||
<configuration>
|
||||
<suiteXmlFiles>
|
||||
<suiteXmlFile>/home/aissel/git2/DCIM_Counts_Check/testng.xml</suiteXmlFile>
|
||||
</suiteXmlFiles>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,49 @@
|
|||
package TestScripts;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import Utilities.ConfigReader;
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class Contacts_Count
|
||||
{
|
||||
public static void main(String[] args) throws InterruptedException
|
||||
{
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
|
||||
|
||||
ConfigReader config = new ConfigReader();
|
||||
|
||||
// Define the sets you want to use
|
||||
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
|
||||
Thread.sleep(10000);
|
||||
for (String set : sets) {
|
||||
Thread.sleep(10000);
|
||||
String url = config.getProperty(set, "url");
|
||||
String username = config.getProperty(set, "username");
|
||||
String password = config.getProperty(set, "password");
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(url);
|
||||
Thread.sleep(10000);
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(username);
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(password);
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
driver.findElement(By.xpath("//div[@class='navLinkMyKolsIn sprite_iconSet']")).click();
|
||||
System.out.println("URL: " + url);
|
||||
System.out.println("Username: " + username);
|
||||
String text= driver.findElement(By.xpath("//label[@id='countKolMsg']")).getText();
|
||||
System.out.println("Contacts: " + text);
|
||||
Thread.sleep(3000);
|
||||
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();
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
driver.quit();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package TestScripts;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
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.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
import org.testng.internal.BaseClassFinder;
|
||||
|
||||
import Utilities.ConfigReader;
|
||||
import Utilities.readConfigFile;
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class Discover_Count
|
||||
{
|
||||
String path = System.getProperty("user.dir");
|
||||
|
||||
public static void main(String[] args) throws InterruptedException
|
||||
{
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
ConfigReader config = new ConfigReader();
|
||||
// Define the sets you want to use
|
||||
//String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
|
||||
String[] sets = {"set1", "set4", "set5", "set6", "set7"};
|
||||
Thread.sleep(10000);
|
||||
for (String set : sets) {
|
||||
Thread.sleep(10000);
|
||||
String url = config.getProperty(set, "url");
|
||||
String username = config.getProperty(set, "username");
|
||||
String password = config.getProperty(set, "password");
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(url);
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(username);
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(password);
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
System.out.println("URL: " + url);
|
||||
System.out.println("Username: " + username);
|
||||
|
||||
driver.findElement(By.xpath("//div[@class='navLinkIdentify sprite_iconSet']")).click();
|
||||
Thread.sleep(5000);
|
||||
WebDriverWait wait = new WebDriverWait(driver, 60);
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[normalize-space()='Reset']")));
|
||||
//wait.until(ExpectedConditions.titleContains("kolsByRankingPager_left"));
|
||||
//JavascriptExecutor jse = (JavascriptExecutor) driver;
|
||||
//jse.executeScript("window.scrollTo(0,document.body.scrollHeight)");
|
||||
|
||||
//driver.findElement(By.xpath("//span[@class='ui-icon ui-icon-seek-end']")).click();
|
||||
try {
|
||||
int totalRowCount = 0;
|
||||
boolean hasNextPage = true;
|
||||
|
||||
while (hasNextPage) {
|
||||
// Find and count the rows on the current page
|
||||
List<WebElement> rows = driver.findElements(By.xpath("//table[@id='kolsByRankingResultSet']/tbody/tr")); // Adjust the XPath to match your table structure
|
||||
int Count = rows.size()-1;
|
||||
Thread.sleep(3000);
|
||||
// Exclude the header row if needed
|
||||
if (Count > 0) {
|
||||
totalRowCount += Count ;
|
||||
System.out.println("Total Number of Disc_contacts : " + Count);
|
||||
}
|
||||
|
||||
// Check if there is a next page
|
||||
WebElement nextPageButton = driver.findElement(By.xpath("//td[@id='next_kolsByRankingPager']")); // Adjust the XPath to match your pagination control
|
||||
if (nextPageButton.getAttribute("class").contains("disabled")) {
|
||||
hasNextPage = false;
|
||||
} else {
|
||||
// Click the "Next" button to navigate to the next page
|
||||
nextPageButton.click();
|
||||
Thread.sleep(4000);
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='gbox_kolsByRankingResultSet']")));
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Total Discover count: " + totalRowCount);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
}
|
||||
Thread.sleep(4000);
|
||||
driver.findElement(By.xpath("//p[@id='settings_menu ']")).click();
|
||||
driver.findElement(By.xpath("//a[@onclick='logoutOtherURLS()']")).click();
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package TestScripts;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.Wait;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
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.support.ui.ExpectedConditions;
|
||||
|
||||
import Utilities.ConfigReader;
|
||||
import Utilities.readConfigFile;
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class Track_Interaction_Count
|
||||
{
|
||||
public static void main(String[] args) throws InterruptedException
|
||||
{
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
ConfigReader config = new ConfigReader();
|
||||
// Define the sets you want to use
|
||||
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
|
||||
|
||||
Thread.sleep(10000);
|
||||
for (String set : sets) {
|
||||
Thread.sleep(10000);
|
||||
String url = config.getProperty(set, "url");
|
||||
String username = config.getProperty(set, "username");
|
||||
String password = config.getProperty(set, "password");
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(url);
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(username);
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(password);
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
System.out.println("URL: " + url);
|
||||
System.out.println("Username: " + username);
|
||||
try {
|
||||
WebElement element = driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']"));
|
||||
element.click();
|
||||
|
||||
//driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click();
|
||||
|
||||
driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
|
||||
Thread.sleep(3000);
|
||||
WebDriverWait wait = new WebDriverWait(driver, 10);
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']")));
|
||||
|
||||
|
||||
try {
|
||||
int totalRowCount = 0;
|
||||
boolean hasNextPage = true;
|
||||
|
||||
while (hasNextPage) {
|
||||
// Find and count the rows on the current page
|
||||
List<WebElement> rows = driver.findElements(By.xpath("//table[@aria-labelledby='gbox_listInteractionsResultSet']/tbody/tr")); // Adjust the XPath to match your table structure
|
||||
int Count = rows.size()-1;
|
||||
Thread.sleep(5000);
|
||||
// Exclude the header row if needed
|
||||
if (Count > 1) {
|
||||
totalRowCount += Count ;
|
||||
System.out.println("Total Number of Interactions : " + Count);
|
||||
}
|
||||
|
||||
// Check if there is a next page
|
||||
WebElement nextPageButton = driver.findElement(By.xpath("//td[@id='next_listInteractionsPage']")); // Adjust the XPath to match your pagination control
|
||||
if (nextPageButton.getAttribute("class").contains("disabled")) {
|
||||
hasNextPage = false;
|
||||
} else {
|
||||
// Click the "Next" button to navigate to the next page
|
||||
nextPageButton.click();
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Total Interactions count: " + totalRowCount);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
package TestScripts;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import Utilities.ConfigReader;
|
||||
import Utilities.readConfigFile;
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class Track_Interaction_Export
|
||||
{
|
||||
public static void main(String[] args) throws InterruptedException
|
||||
{
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
// Set the download directory
|
||||
options.addArguments("download.default_directory=/home/aissel/git4");
|
||||
// Disable the download prompt
|
||||
options.setExperimentalOption("prefs",
|
||||
ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true));
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
ConfigReader config = new ConfigReader();
|
||||
// Define the sets you want to use
|
||||
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
|
||||
//String[] sets = {"set"};
|
||||
Thread.sleep(10000);
|
||||
for (String set : sets) {
|
||||
Thread.sleep(10000);
|
||||
String url = config.getProperty(set, "url");
|
||||
String username = config.getProperty(set, "username");
|
||||
String password = config.getProperty(set, "password");
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(url);
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(username);
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(password);
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
System.out.println("URL: " + url);
|
||||
System.out.println("Username: " + username);
|
||||
|
||||
try {
|
||||
WebElement element = driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']"));
|
||||
element.click();
|
||||
Thread.sleep(3000);
|
||||
//driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click();
|
||||
driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
|
||||
Thread.sleep(3000);
|
||||
|
||||
WebElement downloadButton = driver.findElement(By.xpath("//a[@data-original-title='Export Interaction Detail into Excel format']"));
|
||||
downloadButton.click();
|
||||
Thread.sleep(6000);
|
||||
// Wait for the download to complete (adjust the timeout as needed)
|
||||
WebDriverWait wait = new WebDriverWait(driver, 30);
|
||||
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");
|
||||
if (downloadedFile.exists()) {
|
||||
System.out.println("Downloaded file exists.");
|
||||
} else {
|
||||
System.out.println("Downloaded file does not exist.");
|
||||
}
|
||||
|
||||
} 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
|
||||
readConfigFile Config= new readConfigFile();
|
||||
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(Config.getURL());
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(Config.getUSERNAME());
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(Config.getPASSWORD());
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click();
|
||||
driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
|
||||
//driver.findElement(By.xpath(null))
|
||||
|
||||
|
||||
// Find and click the download link/button
|
||||
WebElement downloadButton = driver.findElement(By.xpath("//a[@data-original-title='Export Interaction Detail into Excel format']"));
|
||||
downloadButton.click();
|
||||
Thread.sleep(5000);
|
||||
|
||||
// Wait for the download to complete (adjust the timeout as needed)
|
||||
WebDriverWait wait = new WebDriverWait(driver, 30);
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@data-original-title='Export Interaction Detail into Excel format']")));
|
||||
|
||||
// Verify the file was downloaded
|
||||
String filePath = "/home/aissel/Downloads";
|
||||
if (isFileDownloaded(filePath)) {
|
||||
System.out.println("Excel file downloaded successfully.");
|
||||
} else {
|
||||
System.out.println("Excel file download failed.");
|
||||
}
|
||||
|
||||
// Close the WebDriver
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
// Function to check if a file exists
|
||||
private static boolean isFileDownloaded(String filePath) {
|
||||
File file = new File(filePath);
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
}*/
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package TestScripts;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.chrome.ChromeOptions;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import Utilities.ConfigReader;
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class Track_Medinsght_Export
|
||||
{
|
||||
public static void main(String[] args) throws InterruptedException
|
||||
{
|
||||
|
||||
ChromeOptions options = new ChromeOptions();
|
||||
// Set the download directory
|
||||
options.addArguments("download.default_directory=/home/aissel/git4");
|
||||
// Disable the download prompt
|
||||
options.setExperimentalOption("prefs",
|
||||
ImmutableMap.of("download.prompt_for_download", false, "download.directory_upgrade", true));
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
ConfigReader config = new ConfigReader();
|
||||
// Define the sets you want to use
|
||||
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6", "set7"};
|
||||
//String[] sets = {"set"};
|
||||
Thread.sleep(10000);
|
||||
for (String set : sets) {
|
||||
Thread.sleep(10000);
|
||||
String url = config.getProperty(set, "url");
|
||||
String username = config.getProperty(set, "username");
|
||||
String password = config.getProperty(set, "password");
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(url);
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(username);
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(password);
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
System.out.println("URL: " + url);
|
||||
System.out.println("Username: " + username);
|
||||
|
||||
try {
|
||||
WebElement element = driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']"));
|
||||
element.click();
|
||||
Thread.sleep(3000);
|
||||
//driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click();
|
||||
driver.findElement(By.xpath("//label[@for='medical_insight']")).click();
|
||||
driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
|
||||
Thread.sleep(3000);
|
||||
|
||||
WebElement downloadButton = driver.findElement(By.xpath("//div[@class='excelExportIcon sprite_iconSet tooltip-demo tooltop-left']"));
|
||||
downloadButton.click();
|
||||
Thread.sleep(6000);
|
||||
// Wait for the download to complete (adjust the timeout as needed)
|
||||
WebDriverWait wait = new WebDriverWait(driver, 30);
|
||||
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");
|
||||
if (downloadedFile.exists()) {
|
||||
System.out.println("Downloaded file exists.");
|
||||
} else {
|
||||
System.out.println("Downloaded file does not exist.");
|
||||
}
|
||||
|
||||
} 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
|
||||
readConfigFile Config= new readConfigFile();
|
||||
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(Config.getURL());
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(Config.getUSERNAME());
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(Config.getPASSWORD());
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click();
|
||||
driver.findElement(By.xpath("//span[normalize-space()='Medical Insight']")).click();
|
||||
driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
|
||||
|
||||
WebElement downloadButton = driver.findElement(By.xpath("//a[@data-original-title='Export Medical Insight Detail into Excel format']"));
|
||||
downloadButton.click();
|
||||
Thread.sleep(6000);
|
||||
|
||||
// Wait for the download to complete (adjust the timeout as needed)
|
||||
WebDriverWait wait = new WebDriverWait(driver, 30);
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[@data-original-title='Export Medical Insight Detail into Excel format']")));
|
||||
|
||||
// Verify the file was downloaded
|
||||
String filePath = "/home/aissel/Downloads";
|
||||
if (isFileDownloaded(filePath)) {
|
||||
System.out.println("Excel file downloaded successfully.");
|
||||
} else {
|
||||
System.out.println("Excel file download failed.");
|
||||
}
|
||||
|
||||
// Close the WebDriver
|
||||
driver.quit();
|
||||
}
|
||||
|
||||
// Function to check if a file exists
|
||||
private static boolean isFileDownloaded(String filePath) {
|
||||
File file = new File(filePath);
|
||||
return file.exists();
|
||||
}
|
||||
}*/
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package TestScripts;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
||||
import Utilities.ConfigReader;
|
||||
import Utilities.readConfigFile;
|
||||
import io.github.bonigarcia.wdm.WebDriverManager;
|
||||
|
||||
public class Track_Medinsight_Count
|
||||
{
|
||||
public static void main(String[] args) throws InterruptedException
|
||||
{
|
||||
WebDriverManager.chromedriver().setup();
|
||||
WebDriver driver = new ChromeDriver();
|
||||
ConfigReader config = new ConfigReader();
|
||||
// Define the sets you want to use
|
||||
String[] sets = {"set1", "set2", "set3", "set4", "set5", "set6"};
|
||||
//String[] sets = {"set"};
|
||||
Thread.sleep(10000);
|
||||
for (String set : sets) {
|
||||
Thread.sleep(10000);
|
||||
String url = config.getProperty(set, "url");
|
||||
String username = config.getProperty(set, "username");
|
||||
String password = config.getProperty(set, "password");
|
||||
driver.manage().window().maximize();
|
||||
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
|
||||
driver.get(url);
|
||||
driver.findElement(By.xpath("//input[@id='username']")).sendKeys(username);
|
||||
driver.findElement(By.xpath("//input[@id='password']")).sendKeys(password);
|
||||
driver.findElement(By.xpath("//input[@id='kc-login']")).click();
|
||||
System.out.println("URL: " + url);
|
||||
System.out.println("Username: " + username);
|
||||
try {
|
||||
WebElement element = driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']"));
|
||||
element.click();
|
||||
Thread.sleep(3000);
|
||||
//driver.findElement(By.xpath("//div[@class='navLinkTrack sprite_iconSet ']")).click();
|
||||
driver.findElement(By.xpath("//label[@for='medical_insight']")).click();
|
||||
driver.findElement(By.xpath("//div[@id='resetBttn']")).click();
|
||||
Thread.sleep(3000);
|
||||
WebDriverWait wait = new WebDriverWait(driver, 10);
|
||||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='wrapper']")));
|
||||
|
||||
|
||||
try {
|
||||
int totalRowCount = 0;
|
||||
boolean hasNextPage = true;
|
||||
|
||||
while (hasNextPage) {
|
||||
// Find and count the rows on the current page
|
||||
List<WebElement> rows = driver.findElements(By.xpath("//table[@aria-labelledby='gbox_listCoachingsResultSet']/tbody/tr")); // Adjust the XPath to match your table structure
|
||||
int Count = rows.size()-1;
|
||||
Thread.sleep(3000);
|
||||
// Exclude the header row if needed
|
||||
if (Count > 0) {
|
||||
totalRowCount += Count ;
|
||||
System.out.println("Total Number of Insight : " + Count);
|
||||
}
|
||||
|
||||
// Check if there is a next page
|
||||
WebElement nextPageButton = driver.findElement(By.xpath("//td[@id='next_listCoachingsPage']")); // Adjust the XPath to match your pagination control
|
||||
if (nextPageButton.getAttribute("class").contains("disabled")) {
|
||||
hasNextPage = false;
|
||||
} else {
|
||||
// Click the "Next" button to navigate to the next page
|
||||
nextPageButton.click();
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Total MedInsight count: " + totalRowCount);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
}
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package Utilities;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
public class ConfigReader
|
||||
{
|
||||
private Properties properties;
|
||||
|
||||
public ConfigReader() {
|
||||
properties = new Properties();
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream("/home/aissel/git4/src/test/resources/browser-config.properties");
|
||||
properties.load(fis);
|
||||
fis.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getProperty(String setName, String key) {
|
||||
// Combine the set name and key to get the property
|
||||
return properties.getProperty(setName + "." + key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package Utilities;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
public class readConfigFile {
|
||||
|
||||
Properties properties;
|
||||
|
||||
String path="/home/aissel/Git2/DICM_Count/src/test/resources/browser-config.properties";
|
||||
|
||||
public readConfigFile()
|
||||
{
|
||||
properties = new Properties();
|
||||
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream(path);
|
||||
try {
|
||||
properties.load(fis);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public String getURL()
|
||||
{
|
||||
String url=properties.getProperty("url");
|
||||
if(url!=null)
|
||||
return url;
|
||||
else
|
||||
throw new RuntimeException("url not specifaid in config file");
|
||||
}
|
||||
|
||||
public String getBROWSER()
|
||||
{
|
||||
String browser=properties.getProperty("browser");
|
||||
if(browser!=null)
|
||||
return browser;
|
||||
else
|
||||
throw new RuntimeException("browser not specifaid in config file");
|
||||
}
|
||||
|
||||
public String getUSERNAME()
|
||||
{
|
||||
String username=properties.getProperty("username");
|
||||
if(username!=null)
|
||||
return username;
|
||||
else
|
||||
throw new RuntimeException("username not specifaid in config file");
|
||||
}
|
||||
|
||||
public String getPASSWORD()
|
||||
{
|
||||
String password=properties.getProperty("password");
|
||||
if(password!=null)
|
||||
return password;
|
||||
else
|
||||
throw new RuntimeException("password not specifaid in config file");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
# Set 1
|
||||
set1.url=https://Syros.konectar.io
|
||||
set1.username=syrosmanager@aissel.com
|
||||
set1.password=Julkonec*23
|
||||
|
||||
# Set 2
|
||||
set2.url=https://cmsu.konectar.io
|
||||
set2.username=cmsumanager@aissel.com
|
||||
set2.password=Jukonec*23
|
||||
|
||||
# Set 3
|
||||
set3.url=https://cardio.konectar.io
|
||||
set3.username=iteosmgr@aissel.com
|
||||
set3.password=Jukonec*23
|
||||
|
||||
# Set 4
|
||||
set4.url=https://cardio.konectar.io
|
||||
set4.username=sareptamgr@aissel.com
|
||||
set4.password=Jukonec*23
|
||||
|
||||
# Set 5
|
||||
set5.url=https://cardio.konectar.io
|
||||
set5.username=tika_manager@aissel.com
|
||||
set5.password=Jukonec*23
|
||||
|
||||
# Set 6
|
||||
set6.url=https://cardio.konectar.io
|
||||
set6.username=bdtxmanager@aissel.com
|
||||
set6.password=Welcome@1234
|
||||
|
||||
# Set 7
|
||||
set7.url=https://tidesmedical.konectar.io
|
||||
set7.username=tidesmanager@aissel.com
|
||||
set7.password=Jukonec*23
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||
<suite name="Suite">
|
||||
<test thread-count="5" name="Test" junit="true">
|
||||
<classes>
|
||||
<class name="StepDefinitions.testRunnerTest"/>
|
||||
</classes>
|
||||
</test> <!-- Test -->
|
||||
</suite> <!-- Suite -->
|
Loading…
Reference in New Issue