NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package pack_20_DataDrive;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
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.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import reusableComponents.reusableComponents;
import jxl.Sheet;
import jxl.Workbook;

public class ThreadClass implements Runnable {

WebDriver driver;

HashMap<String, String> map, map1;

int row, row1;

String[][] getexceldatainArray, getexceldatainArray1;

Workbook getexceldatafrom_wb;

Sheet sheetNumber, sheetNumber1;

String threadName, Action;

public ThreadClass(String threadName, Workbook getexceldatafrom_wb) {

this.getexceldatafrom_wb = getexceldatafrom_wb;

this.threadName = threadName;

}

@Override
public void run() {

System.out.println("in thread "+threadName);

Sheet sheetNumber1 = getexceldatafrom_wb.getSheet(0);

try
{
getexceldatainArray = reusableComponents.CreateArrayfromExcel(getexceldatafrom_wb, sheetNumber1);
}
catch (Exception e1)
{
e1.printStackTrace();
}
//---
row = sheetNumber1.getRows();

for(int i = 1; i < row ; i++)
{
map = reusableComponents.DataDictionaryFromArray1(getexceldatainArray, i);

String JID = map.get("JourneyID");

Sheet sheetNumber2 = getexceldatafrom_wb.getSheet(1);

try
{
getexceldatainArray1 = reusableComponents.CreateArrayfromExcel(getexceldatafrom_wb, sheetNumber2);
}
catch (Exception e1)
{
e1.printStackTrace();
}

//---
row1 = sheetNumber2.getRows();

//comparing Journey ID code goes here

for(int i1 = 1; i1 < row1 ; i1++)
{
if(sheetNumber2.getCell(0, i1).getContents().equals(JID))
{
while(sheetNumber2.getCell(0, i1).getContents().equals(JID))
{
//System.out.println(sheetNumber2.getCell(0, i1).getContents().equals(map.get("JourneyID"))+" so flow continues");

map1 = reusableComponents.DataDictionaryFromArray1(getexceldatainArray1, i1);

Action = map1.get("Action");
switch(Action){
case "launchBrowser" : launchBrowser(); break;
case "launchUrl" : launchUrl(); break;
case "enterUsername" : enterUsername(); break;
case "clickSubmit" : clickSubmit(); break;
case "enterPassword" : enterPassword(); break;
case "SearchText" : SearchText(); break;
case "SignInClick" : SignInClick(); break;

default:System.out.println("not in the action methods list");
}

if(++i1 < row1)
{
int k = i1;

if(!sheetNumber2.getCell(0, k).getContents().equals(map.get("JourneyID")))
{

driver.close();

System.out.println("Test case for the journey ID - "+map.get("JourneyID")+" using thread - "+threadName+" is completed");

break;
}

}
else
{
driver.close();

System.out.println("Test case for the journey ID - "+map.get("JourneyID")+" using thread - "+threadName+" is completed");

break;

}
}
//break;
}
else
{
continue;
}
}
//driver.close();
}

System.out.println("closing "+threadName);
}

public void SignInClick(){
reusableComponents.isElementPresnt(driver, map.get("SignInLinkXpath"), 10).click();
}
public void SearchText() {

//reusableComponents.isElementPresnt(driver, xpath, time)
// //*[@id="lst-ib"]
//driver.findElement(By.name("q")).sendKeys(map.get("SearchText"));
reusableComponents.isElementPresnt(driver, map.get("SearchTextXpath"), 10).sendKeys(map.get("SearchText"));
}

public void enterPassword() {
// TODO Auto-generated method stub
reusableComponents.isElementPresnt(driver, map.get("PasswordXpath"), 10).sendKeys(map.get("Password"));
}

public void clickSubmit() {
// TODO Auto-generated method stub
//driver.findElement(By.xpath("//*[@id='identifierNext']")).click();
reusableComponents.isElementPresnt(driver, map.get("SignInButton"), 10).click();
}

public void enterUsername() {
// TODO Auto-generated method stub
//driver.findElement(By.xpath("")).sendKeys(map.get("Username"));
reusableComponents.isElementPresnt(driver, map.get("UsernameXpath"), 10).sendKeys(map.get("Username"));
}

public void launchUrl() {
// TODO Auto-generated method stub
driver.get(map.get("Url"));
}

public void launchBrowser() {

System.setProperty("webdriver.chrome.driver",".//chromedriver.exe");

driver = new ChromeDriver();
}


}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.