Notes
![]() ![]() Notes - notes.io |
import java.io.FileInputStream;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class MultithreadPOC implements Runnable {
public static final String driverPath_chrome1 = "/Users/v4/Documents/Selenium POI Jars_Drivers/chromedriver";
WebDriver driver;
String url = "https://10.20.239.142:8081/s2b/global/corporate/v1.0/implementation/app/login.html";
String userName, gid ;
// private static XSSFWorkbook ExcelWBook;
// private static XSSFSheet ExcelWSheet;
public MultithreadPOC(String userName, String gid) {
// TODO Auto-generated constructor stub
this.userName = userName;
this.gid= gid;
//super(thrdName);
}
@Override
public void run(){
System.out.println("Thread started"+Thread.currentThread().getName());
System.out.println(Thread.currentThread().getName()+"user Name"+userName + " group id" + gid);
try{
//Thread.sleep(3000);
readDataFromExcel();
//browserInit();
//applicationLaunch(userName,gid);
//driver.quit();
}
catch(Exception e){
System.out.println(e.getMessage());
}
System.out.println("Thread Ends Here"+Thread.currentThread().getName());
}
//input[@placeholder='User ID'])[1]
private void applicationLaunch(String userName, String gid) {
// TODO Auto-generated method stub
driver.get(url);
String pageTitle = driver.getTitle();
System.out.println(pageTitle);
driver.findElement(By.xpath("//input[@placeholder='User ID'][1]")).sendKeys(userName);
driver.findElement(By.xpath("//p[@class='button-text'][1]")).click();
driver.findElement(By.xpath("//input[@placeholder='Group ID']")).sendKeys(gid);
}
private void browserInit() {
// TODO Auto-generated method stub
ChromeOptions options= new ChromeOptions();
options.addArguments("disable-infobars");
System.setProperty("webdriver.chrome.driver", driverPath_chrome1);
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
private void readDataFromExcel() throws IOException, InvalidFormatException
{
String s="/Users/v4/Downloads/testProject/testData/TestDataForHybridFramework_TDD_working.xlsx";
FileInputStream fis=new FileInputStream(s);
Workbook wb=WorkbookFactory.create(fis);
Sheet sh=wb.getSheet("Test Data Sheet");
Row rw=sh.getRow(1);
String dat=rw.getCell(0).getStringCellValue();
System.out.println("user data+++++++++" +dat);
fis.close();
}
public static void main(String[] args) {
//
// //Thread t1 = new MultithreadPOC("Thread1");
// //Thread t2 = new MultithreadPOC("Thread2");
// System.out.println("Starting threads");
// t1.start();
// t2.start();
// System.out.println("Threads have been started");
Runnable t1 =new MultithreadPOC("[email protected]","gid01");
Runnable t2 =new MultithreadPOC("[email protected]","gid02");
Runnable t3 =new MultithreadPOC("[email protected]","gid03");
Runnable t4 =new MultithreadPOC("[email protected]","gid04");
//Runnable t5 =new MultithreadPOC("[email protected]");
new Thread(t1).start();
// new Thread(t2).start();
// new Thread(t3).start();
// new Thread(t4).start();
}
}
/*
public class MultithreadPOC extends Thread {
public static final String driverPath_chrome1 = "/Users/v4/Documents/Selenium POI Jars_Drivers/chromedriver";
WebDriver driver;
String url = "https://10.20.239.142:8081/s2b/global/corporate/v1.0/implementation/app/login.html";
public MultithreadPOC(String thrdName) {
// TODO Auto-generated constructor stub
super(thrdName);
}
@Override
public void run(){
System.out.println("Thread started"+MultithreadPOC.currentThread().getName());
try{
Thread.sleep(3000);
browserInit();
applicationLaunch();
//driver.quit();
}
catch(Exception e){
System.out.println(e.getMessage());
}
System.out.println("Thread Ends Here"+MultithreadPOC.currentThread().getName());
}
private void applicationLaunch() {
// TODO Auto-generated method stub
driver.get(url);
String pageTitle = driver.getTitle();
System.out.println(pageTitle);
}
private void browserInit() {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", driverPath_chrome1);
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
public static void main(String[] args) {
Thread t1 = new MultithreadPOC("Thread1");
Thread t2 = new MultithreadPOC("Thread2");
System.out.println("Starting threads");
t1.start();
t2.start();
System.out.println("Threads have been started");
}
}
*/
![]() |
Notes is a web-based application for online 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 14 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