42# How to read properties file in Selenium || Selenium Automation ||

Опубликовано: 04 Ноябрь 2024
на канале: Knowledge Share
372
8

In this session you will learn how to read properties file in Selenium and how it is used in Selenium Automation

Please find the code for this session at the end

You will learn below concepts
What is Properties file
Structure of Properties File
Why Properties file is used in Automation

Please download all codes from below github repository
https://github.com/knowledgeshare-tec...

𝐃𝐨 𝐲𝐨𝐮 𝐰𝐚𝐧𝐭 𝐭𝐨 𝐥𝐞𝐚𝐫𝐧 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦 𝐀𝐮𝐭𝐨𝐦𝐚𝐭𝐢𝐨𝐧 𝐢𝐧 𝐯𝐞𝐫𝐲 𝐞𝐚𝐬𝐲 𝐰𝐚𝐲 ?
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
𝐘𝐨𝐮 𝐜𝐚𝐧 𝐣𝐨𝐢𝐧 𝐛𝐞𝐥𝐨𝐰 𝐆𝐫𝐨𝐮𝐩 𝐟𝐨𝐫 𝐦𝐨𝐫𝐞 𝐮𝐩𝐝𝐚𝐭𝐞𝐬 𝐚𝐧𝐝 𝐟𝐨𝐫 𝐜𝐨𝐥𝐥𝐚𝐛𝐨𝐫𝐚𝐭𝐢𝐨𝐧
  / 4754296501308288  
𝐈𝐟 𝐲𝐨𝐮 𝐰𝐚𝐧𝐭 𝐭𝐨 𝐝𝐢𝐬𝐜𝐮𝐬𝐬 𝐨𝐫 𝐬𝐡𝐚𝐫𝐞 𝐨𝐫 𝐠𝐚𝐢𝐧 𝐤𝐧𝐨𝐰𝐥𝐞𝐝𝐠𝐞 𝐨𝐫 𝐭𝐫𝐨𝐮𝐛𝐥𝐞𝐬𝐡𝐨𝐨𝐭 𝐈𝐬𝐬𝐮𝐞𝐬 𝐛𝐲 𝐭𝐚𝐤𝐢𝐧𝐠 𝐡𝐞𝐥𝐩 𝐣𝐨𝐢𝐧 𝐭𝐡𝐞 𝐛𝐞𝐥𝐨𝐰 𝐅𝐨𝐫𝐮𝐦
https://chat.whatsapp.com/Drhb7GEZcrA...
𝐂𝐨𝐫𝐞 𝐉𝐚𝐯𝐚 𝐁𝐚𝐬𝐢𝐜 𝐂𝐨𝐧𝐜𝐞𝐩𝐭𝐬 𝐏𝐥𝐚𝐲𝐥𝐢𝐬𝐭
   • Core Java  
𝐎𝐎𝐏𝐒 𝐂𝐨𝐧𝐜𝐞𝐩𝐭𝐬 𝐏𝐥𝐚𝐲𝐥𝐢𝐬𝐭
   • OOPS Concepts in Java  
𝐅𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤 𝐏𝐫𝐞-𝐫𝐞𝐪𝐮𝐢𝐬𝐢𝐭𝐞𝐬
   • Framework Pre-requisites  
𝐆𝐢𝐭𝐇𝐮𝐛 𝐑𝐞𝐩𝐨 𝐟𝐨𝐫 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦 𝐁𝐚𝐬𝐢𝐜 𝐏𝐫𝐨𝐠𝐫𝐚𝐦𝐬 𝐏𝐫𝐚𝐜𝐭𝐢𝐜𝐞
https://github.com/knowledgeshare-tec...
𝐆𝐢𝐭𝐇𝐮𝐛 𝐑𝐞𝐩𝐨 𝐟𝐨𝐫 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦 𝐅𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤 𝐝𝐞𝐬𝐢𝐠𝐧 𝐜𝐨𝐧𝐜𝐞𝐩𝐭𝐬
https://github.com/knowledgeshare-tec...
𝐆𝐢𝐭𝐇𝐮𝐛 𝐑𝐞𝐩𝐨 𝐟𝐨𝐫 𝐂𝐨𝐫𝐞 𝐉𝐚𝐯𝐚 𝐩𝐫𝐨𝐠𝐫𝐚𝐦𝐬 𝐩𝐫𝐚𝐜𝐭𝐢𝐜𝐞
https://github.com/knowledgeshare-tec...

Program on how to read properties file
================================

package readPropertiesFile;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class readfFromPropertiesFile {

public static void main(String[] args) throws IOException
{

Properties properties=new Properties();
FileInputStream inputstream = new FileInputStream(System.getProperty("user.dir")+"\\TestData\\" + "Environments" + ".properties");

properties.load(inputstream);
//System.out.println("Google URL is : " + properties.getProperty("google_url"));
String url=properties.getProperty("google_url");
System.out.println(url);
WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
driver.get(url);

}

}

#SeleniumAutomation
#WebDriver
#KnoweldgeShare
#Automation
#SelectorsHub