音が流れない場合、再生を一時停止してもう一度再生してみて下さい。
ツール 
画像
Knowledge Share
4357回再生
40# How to write in to Excel || User Login Scenario II Apache POI || Selenium Automation

In this session you will learn how to write to an excel file using Apache POI in selenium

In this session I have explained an example on user login test , where you will write the results in to an excel.

Before watching this video, please watch how to read an excel file so that you will comfortable to learn how to write in to excel
   • 39# How to Read Excel Column names   User ...  

Please download all codes from below github repository
github.com/knowledgeshare-technologies/framework-p…

𝐃𝐨 𝐲𝐨𝐮 𝐰𝐚𝐧𝐭 𝐭𝐨 𝐥𝐞𝐚𝐫𝐧 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦 𝐀𝐮𝐭𝐨𝐦𝐚𝐭𝐢𝐨𝐧 𝐢𝐧 𝐯𝐞𝐫𝐲 𝐞𝐚𝐬𝐲 𝐰𝐚𝐲 ?
Learn Selenium in easy way by dividing the concepts in to Module wise. Below are the list of Modules wise learning, each contains max 4 to 5 videos that you can complete in 1 or 2 days.
🅽🅾🆃🅴
You have all practice programs pasted in the description on each video.
You have GitHub Repository where all the programs are stored at one place for your practice.
Links pasted at the end
𝐘𝐨𝐮 𝐜𝐚𝐧 𝐣𝐨𝐢𝐧 𝐛𝐞𝐥𝐨𝐰 𝐆𝐫𝐨𝐮𝐩 𝐟𝐨𝐫 𝐦𝐨𝐫𝐞 𝐮𝐩𝐝𝐚𝐭𝐞𝐬 𝐚𝐧𝐝 𝐟𝐨𝐫 𝐜𝐨𝐥𝐥𝐚𝐛𝐨𝐫𝐚𝐭𝐢𝐨𝐧
www.facebook.com/groups/4754296501308288/
𝐈𝐟 𝐲𝐨𝐮 𝐰𝐚𝐧𝐭 𝐭𝐨 𝐝𝐢𝐬𝐜𝐮𝐬𝐬 𝐨𝐫 𝐬𝐡𝐚𝐫𝐞 𝐨𝐫 𝐠𝐚𝐢𝐧 𝐤𝐧𝐨𝐰𝐥𝐞𝐝𝐠𝐞 𝐨𝐫 𝐭𝐫𝐨𝐮𝐛𝐥𝐞𝐬𝐡𝐨𝐨𝐭 𝐈𝐬𝐬𝐮𝐞𝐬 𝐛𝐲 𝐭𝐚𝐤𝐢𝐧𝐠 𝐡𝐞𝐥𝐩 𝐣𝐨𝐢𝐧 𝐭𝐡𝐞 𝐛𝐞𝐥𝐨𝐰 𝐅𝐨𝐫𝐮𝐦
chat.whatsapp.com/Drhb7GEZcrA7Jat1nGEkrq
𝐂𝐨𝐫𝐞 𝐉𝐚𝐯𝐚 𝐁𝐚𝐬𝐢𝐜 𝐂𝐨𝐧𝐜𝐞𝐩𝐭𝐬 𝐏𝐥𝐚𝐲𝐥𝐢𝐬𝐭
   • Core Java  
𝐎𝐎𝐏𝐒 𝐂𝐨𝐧𝐜𝐞𝐩𝐭𝐬 𝐏𝐥𝐚𝐲𝐥𝐢𝐬𝐭
   • OOPS Concepts in Java  
𝐅𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤 𝐏𝐫𝐞-𝐫𝐞𝐪𝐮𝐢𝐬𝐢𝐭𝐞𝐬
   • Framework Pre-requisites  
𝐆𝐢𝐭𝐇𝐮𝐛 𝐑𝐞𝐩𝐨 𝐟𝐨𝐫 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦 𝐁𝐚𝐬𝐢𝐜 𝐏𝐫𝐨𝐠𝐫𝐚𝐦𝐬 𝐏𝐫𝐚𝐜𝐭𝐢𝐜𝐞
github.com/knowledgeshare-technologies/SeleniumBas…
𝐆𝐢𝐭𝐇𝐮𝐛 𝐑𝐞𝐩𝐨 𝐟𝐨𝐫 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦 𝐅𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤 𝐝𝐞𝐬𝐢𝐠𝐧 𝐜𝐨𝐧𝐜𝐞𝐩𝐭𝐬
github.com/knowledgeshare-technologies/framework-p…
𝐆𝐢𝐭𝐇𝐮𝐛 𝐑𝐞𝐩𝐨 𝐟𝐨𝐫 𝐂𝐨𝐫𝐞 𝐉𝐚𝐯𝐚 𝐩𝐫𝐨𝐠𝐫𝐚𝐦𝐬 𝐩𝐫𝐚𝐜𝐭𝐢𝐜𝐞
github.com/knowledgeshare-technologies/corejava

package excelRead_Write;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
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 io.github.bonigarcia.wdm.WebDriverManager;
public class ReadExcelUserLoginTest {
public static void main(String[] args) throws IOException, InterruptedException
{
File file=new File(System.getProperty("user.dir") + "\\TestData\\" + "Regression_TestData" + ".xlsx");
FileInputStream inputstream=new FileInputStream(file);
XSSFWorkbook wb=new XSSFWorkbook(inputstream);
XSSFSheet sheet=wb.getSheet("LoginDetails");
/* Open Login page */
WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
driver.get("demowebshop.tricentis.com/login");

XSSFRow row=null;
XSSFCell cell=null;
String userName=null;
String password=null;
for (int i=1; iLT=sheet.getLastRowNum();i++)
{
row=sheet.getRow(i);
for ( int j=0;jLTrow.getLastCellNum();j++)
{
cell=row.getCell(j);

if(j==0) // We can use Column Name as well, will see in upcoming sessions
{
userName=cell.getStringCellValue();
}
if(j==1) // We can use Column Name as well, will see in upcoming sessions
{
password=cell.getStringCellValue();
}
}
driver.findElement(By.id("Email")).sendKeys(userName);
driver.findElement(By.id("Password")).sendKeys(password);
driver.findElement(By.xpath("//*[@value='Log in']")).click();
String result=null;
try
{
Boolean isLoggedIn=driver.findElement(By.xpath("//a[text()='Log out']")).isDisplayed();
if(isLoggedIn==true)
{
result="PASS";
// Writing to an excel
cell=row.createCell(2);
cell.setCellType(cell.CELL_TYPE_STRING);
cell.setCellValue(result);
}
System.out.println("User Name : " + userName + " --- " + "Password : " + password + "---- Login success ? ------ " + result);
//System.out.println("Login successfull : " + isLoggedIn);
driver.findElement(By.xpath("//a[text()='Log out']")).click();
}
catch(Exception e)
{
Boolean isError=driver.findElement(By.xpath("//*[text()='The credentials provided are incorrect']")).isDisplayed();
if(isError==true)
{
result="FAIL";
cell=row.createCell(2);
cell.set

コメント