Selenium Framework for Beginners 17 | What is Properties File | How to use

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 85

  • @papridutta2336
    @papridutta2336 3 года назад +3

    Raghav Sir you are best in teaching and explaining things step by step. The name of your Channel "Automation Step by Step" is absolutely sync with your teaching style .You are gem.

  • @yaseerpasha6143
    @yaseerpasha6143 Год назад

    Awesome. Was searching so many videos..but this was the best explanation

    • @RaghavPal
      @RaghavPal  Год назад

      Glad it helped Yaseer

    • @yaseerpasha6143
      @yaseerpasha6143 Год назад

      @@RaghavPal yeah i had an interview today and had to explain properties files and Excel file .. thank you for the valuable information.. keep doing more.. May God bless you.🥰

  • @aloksharma1426
    @aloksharma1426 5 лет назад +2

    Awesome session sir
    great and clear explanation sir😊

    • @RaghavPal
      @RaghavPal  5 лет назад

      Thanks for watching. :)

  • @RajibLama
    @RajibLama 2 года назад

    Thank you for beautiful explanation of using properties file. 👏👏

    • @RaghavPal
      @RaghavPal  2 года назад

      You are welcome Rajib

  • @nagalakshmikothuru6603
    @nagalakshmikothuru6603 Год назад

    very much useful video for me..thank u

    • @RaghavPal
      @RaghavPal  Год назад

      So nice of you Nagalakshmi

  • @jeanmarteau3186
    @jeanmarteau3186 Год назад

    ​ @Automation Step by Step Hello and thank you for all your tutos.
    I have a question :
    What do you think about ResourceBundle class to get the data of properties file?
    what is the difference between ResourceBundle class and Properties class.
    Thank you bro

    • @RaghavPal
      @RaghavPal  Год назад +1

      Hi Jean,
      The ResourceBundle class is a powerful and convenient way to retrieve localized resources and data from properties files in Java. It provides a standard way to handle multiple locales and is highly flexible and extensible
      In comparison to the Properties class, which is also used for handling properties files in Java, the ResourceBundle class provides a more robust and scalable solution. While the Properties class is simple and easy to use for smaller projects, it becomes more difficult to maintain when working with larger applications that require multiple languages or locales.
      One of the key differences between the two classes is that ResourceBundle is designed to handle localization by allowing you to specify multiple versions of the same properties file for different languages or regions. This is done by creating separate properties files for each language and naming them accordingly, such as messages_en.properties for English or messages_fr.properties for French.

    • @jeanmarteau3186
      @jeanmarteau3186 Год назад

      @@RaghavPal Merci, Thank you

  • @saleemshaikh3304
    @saleemshaikh3304 5 лет назад +1

    Excellent session..clear and content full explanation..

    • @RaghavPal
      @RaghavPal  5 лет назад

      Thanks for watching Saleem

    • @benedicturiah7037
      @benedicturiah7037 3 года назад

      Sorry to be offtopic but does anyone know of a method to get back into an instagram account..?
      I somehow forgot the password. I would love any tricks you can give me!

    • @krewashton264
      @krewashton264 3 года назад

      @Benedict Uriah Instablaster ;)

    • @benedicturiah7037
      @benedicturiah7037 3 года назад

      @Krew Ashton i really appreciate your reply. I found the site through google and Im in the hacking process now.
      Seems to take a while so I will get back to you later with my results.

    • @benedicturiah7037
      @benedicturiah7037 3 года назад

      @Krew Ashton It worked and I actually got access to my account again. I am so happy:D
      Thanks so much, you saved my ass :D

  • @ankitchoudhary9
    @ankitchoudhary9 3 года назад

    Sir very nice explanation thanks

  • @maruthupandiyan8390
    @maruthupandiyan8390 Год назад

    awesome session Sir ☺️

  • @nirmalavare4246
    @nirmalavare4246 5 лет назад

    Good explanation ragahv..thanks for video

    • @RaghavPal
      @RaghavPal  5 лет назад

      You're welcome Nirmala

  • @Ermal520
    @Ermal520 Год назад

    Hi Raghav, which is best place to keep properties file under src/test/resources or src/test/java?

    • @RaghavPal
      @RaghavPal  Год назад

      Hi Sumana,
      your code.
      If the properties file is intended to be a configuration file, where you store values that control the behavior of your tests, then it should be kept under the src/test/resources directory. This is because resources under this directory will be automatically included in the classpath of your tests, making it easy to read the properties file from your test code
      On the other hand, if the properties file is intended to be a utility file, where you define constants or helper methods that will be used by your test code, then it should be kept under the src/test/java directory, along with your other test code. This is because the properties file is part of your test code, and should be packaged and compiled with your test classes
      In general, it is a good practice to keep your configuration files separate from your test code, so that they can be easily updated without requiring changes to your test code

  • @jayanthipanuganti1453
    @jayanthipanuganti1453 2 года назад

    Thank you

  • @niharshiplu
    @niharshiplu 2 года назад

    Hi Raghav,one quick question.Why properties.load() call is not needed for OutputStrem class or when you writing something on the the properties file?

    • @RaghavPal
      @RaghavPal  2 года назад

      Hi Nihar, that is needed to read properties file

  • @mohdshahrukh5164
    @mohdshahrukh5164 2 года назад

    Awesomeee

  • @ManishSharma-kt9ze
    @ManishSharma-kt9ze 4 года назад

    Sir..here we have used property file concept....also we can derive our data from Excel through Apache poi...So which approach we used nowadays??

    • @RaghavPal
      @RaghavPal  4 года назад +1

      For some limited properties, you can use a property file created within the project. Else can go with Excel for large and dynamic values

    • @ManishSharma-kt9ze
      @ManishSharma-kt9ze 4 года назад

      @@RaghavPal ok thanks sir

  • @rangabharath4253
    @rangabharath4253 5 лет назад

    Awesome

  • @shubhamverma7237
    @shubhamverma7237 4 года назад +1

    what if there are multiple classes then how to access properties file? as propertiesfile class is using the class where browser is needed
    .

    • @RaghavPal
      @RaghavPal  4 года назад +1

      You can create a separate instance of properties file, make it global and then you can call it from any class

    • @shubhamverma7237
      @shubhamverma7237 4 года назад

      @@RaghavPal in getProperties method u have used "className.browserName=browser". where we have to pass the browser name. So if there are multiple classes then do we have to add all those classes in getProperties method?

    • @RaghavPal
      @RaghavPal  4 года назад +1

      I believe you need to get the values from prop file in multiple classes, So you can create one class with a constructor where you set the properties file and then in each of the class create an object of this class which will always call the constructor and then you can use the properties file values

    • @shubhamverma7237
      @shubhamverma7237 4 года назад

      @@RaghavPal Thanks a lot for your help and for the tutorials. Every tutorial is very helpful and well explained. 🙂

  • @pranavsteyn9441
    @pranavsteyn9441 3 года назад +1

    Sir ,how to add more properties like URL,username,password to the properties file.

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Pranav, can add and use the same way as shown, just try and can also check some online examples

  • @radhamanogari6024
    @radhamanogari6024 4 года назад

    Such an awesome session!!
    In this session you have shown how to derive data for one field(browser) , how can I derive the data for different fields eg. url, username , password etc. if i defined in the .properties files. Basically I want to know whether is it possible to parameterize the methods for .properties files if yes means, can you help me on this?

    • @RaghavPal
      @RaghavPal  4 года назад

      Hi Radha, the process should be the same for any parameter, you can try and let me know if you face any issues

  • @archanamuthukrishnan6465
    @archanamuthukrishnan6465 2 года назад

    Hello Sir
    In my project they are asking not to use application url ,crdentials in properties file...while integration with jenkins ...what are alternative options available ?
    Please help me sir..

    • @RaghavPal
      @RaghavPal  2 года назад

      Hi Archana,
      Can keep them as parameters in a jenkins job, Check parameterized job video in Jenkins playlist

  • @shavdaadhikari32
    @shavdaadhikari32 3 года назад

    Excellent explanation. when i am trying my own i cannot call TestNG_Demo class in propertiesFile class. (ie demo class is one package and propertiesFile class is in another package ) should i need to add any dependencies if i am looking just this session.

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Shavda, you may try importing the class

    • @shavdaadhikari32
      @shavdaadhikari32 3 года назад

      thank you sir but i could not import the class too. as TestNG_demo class is in
      src/test/java and PropertiesFile class is in src/main/java and i am trying to write TestNG.browserName=browser; in Properties class and i couldnot....

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Shavda, can you check the complete setup again and compare with the videos, I believe something is missed

  • @TheAllanazarpour
    @TheAllanazarpour 2 года назад

    Hello, I would like to read and write back to the same properties file throughout several test cases with getProperty/setProperty method. The configuration is in the Base class. The reading part works fine, however, it does not write back. What could be the reason?

    • @RaghavPal
      @RaghavPal  2 года назад

      Hi, will need to check the code and logs

  • @khadarmastanbug_hunter867
    @khadarmastanbug_hunter867 5 лет назад

    Hi Rahav, I am having two cases, i want to use output of the 1st case in case2, for this I have stored the output of the case1 in some property file called x.properties. So Now i am running the my class file, case1 is executed successfully and the o/p is stored in x.properties, but the same output is passed as "null" for case2.
    But if I run the two cases individually, getting the value of the case1.
    Note : i am using the @test for the both cases and executing.
    Can you please guide me how to resolve this issue

    • @RaghavPal
      @RaghavPal  5 лет назад

      Hi Khadar, will have to see your project and code.

  • @vjkrish47
    @vjkrish47 3 года назад

    Hi Raghav,
    i have doubt,y we have write in main/test/java.
    why we can't write in main/resources..
    can you tell me,what we have to in the main/resources and main/test...sometimes you use main/resources in log4j..i am getting confusion..

    • @RaghavPal
      @RaghavPal  3 года назад +1

      Hi Vijay, usually the files/resources related to tests go in main/test/java folder, this is helpful if effective organisation. Can check this dzone.com/articles/how-to-organize-resource-files-for-tests-using-mav

    • @madhavilatha1996
      @madhavilatha1996 3 года назад

      @@RaghavPal thank you so much...
      I am following your automation video..you are best, you are very good in teaching and helping..again big thanks to clearing doubts..this not first time getting reply from you, for every lesson, you are giving reply to me..God bless your life fulfill with your dreams..thank you sir..

    • @RaghavPal
      @RaghavPal  3 года назад

      thanks for the kind words Madhavi

  • @shubhamverma7237
    @shubhamverma7237 4 года назад

    can we use one class of propertiesfile for multiple classes?

    • @RaghavPal
      @RaghavPal  4 года назад +1

      Yes we can Shubham

  • @charankasanagottu4418
    @charankasanagottu4418 3 года назад

    sir shall we have git hub or any link to go through the code you wrote

    • @RaghavPal
      @RaghavPal  3 года назад

      can check here github.com/Raghav-Pal/SeleniumJavaFramework1

  • @pranavsteyn9441
    @pranavsteyn9441 3 года назад

    sir iam getting this error -->Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property;
    Iam not using TestNG but .Can you help me with this

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Pranav, have you downloaded gekcko driver and have you set the path, this is shown in earlier videos of this series too
      System.setProperty("webdriver.gecko.driver", "path/to/geckodriver.exe");

  • @KumarS-gf4fl
    @KumarS-gf4fl Год назад

    How to feed implicit time from property file

    • @RaghavPal
      @RaghavPal  Год назад

      Hi Kumar,
      To feed the implicit time from a property file in Selenium Java, you can follow these steps:
      Create a properties file (let's say config.properties) and store the implicit time value in it. For example, you can store the implicit time as implicitTime=10 where 10 is the number of seconds.
      Load the properties file in your Java code using the java.util.Properties class. You can use the load() method to load the file and get the value of the implicit time property as shown below:
      import java.util.Properties;
      import java.io.FileInputStream;
      import java.io.IOException;
      public class Example {
      public static void main(String[] args) throws IOException {
      Properties prop = new Properties();
      FileInputStream fis = new FileInputStream("config.properties");
      prop.load(fis);
      // Get the implicit time value from the properties file
      String implicitTime = prop.getProperty("implicitTime");
      // Convert the value to an integer
      int implicitTimeInSeconds = Integer.parseInt(implicitTime);
      // Use the implicit time in your Selenium code
      WebDriver driver = new ChromeDriver();
      driver.manage().timeouts().implicitlyWait(implicitTimeInSeconds, TimeUnit.SECONDS);
      }
      }
      In this example, we are using the FileInputStream class to read the properties file and the getProperty() method to get the value of the implicitTime property. We are then converting the value to an integer and using it in the implicitlyWait() method of the WebDriver instance.
      Note: Make sure that the properties file is in the correct location and is accessible by your Java code.

  • @yadagirireddymaila3925
    @yadagirireddymaila3925 4 года назад

    Hi Pal
    I like the Video But I am having issue with The TestNg Annotations.
    when i write @BeforeTest annotation . import option is not showing in eclipse ide
    Please help me
    Thanks in advance Pal

    • @RaghavPal
      @RaghavPal  4 года назад

      Hi Yadagiri, if there is no error, than its fine. Also check the imports at the top of your class, If you have import from junit you can delete and get the import from testng.

  • @ashvinipatil8654
    @ashvinipatil8654 4 года назад

    What I to do to get properties.class file in my eclipse

    • @RaghavPal
      @RaghavPal  4 года назад

      Hi Ashvini, although I do not know exact scenario, you can get help here
      www.geeksforgeeks.org/java-util-properties-class-java/
      www.javatpoint.com/properties-class-in-java

  • @bhaktigarje2651
    @bhaktigarje2651 2 года назад

    Why we use try and catch in this,?

    • @RaghavPal
      @RaghavPal  2 года назад

      for exception handling

    • @bhaktigarje2651
      @bhaktigarje2651 2 года назад

      @@RaghavPal how do we know that there will be exception??

    • @RaghavPal
      @RaghavPal  2 года назад

      Try catch block is to handle runtime exceptions in case they occur

    • @bhaktigarje2651
      @bhaktigarje2651 2 года назад

      @@RaghavPal okay

  • @pavantejas4279
    @pavantejas4279 4 года назад

    Hi sir I cannot able to get getproperties() in propertiesfile.

    • @RaghavPal
      @RaghavPal  4 года назад

      What is the error/logs Pavan

  • @Deniz-ss1sv
    @Deniz-ss1sv 3 года назад

    :)

  • @faisalsakib9586
    @faisalsakib9586 6 лет назад

    Can you please share those slides

    • @RaghavPal
      @RaghavPal  6 лет назад

      Faisal, you can find all the details in the notes/description, let me know if you need any other notes if missed there.