Selenium Beginner Tutorial 10 - How To Use Config Properties File

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

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

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

    Hello ..after 9 yrs I have decided to returnback to work....I have just started learning selenium.....your channel is big help...excellent work.

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

      So happy to know this Seema. All the best

  • @jesseallaway1149
    @jesseallaway1149 6 лет назад +2

    Your videos have been excellent so far for me as a brand-new-to-Selenium person, thank you for all your work!

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

    Super boss, i am a beginner and learning by watching your videos...good job..and thank you.

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

      You're welcome. Keep learning.

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

    I never loose my interest in the topic while watching ur learning sessions..Thanks Raghav

  • @MrAmarSindol
    @MrAmarSindol 7 лет назад +1

    Excellent bro, very happy that u explained all possible scenarios, was looking for such quality content on youtube.

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

    hellow Mr Raghaf ,the way that you explain the tutorial is most marvelous, i can say it is so easy as it is so preventive , many thanks

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

      So nice of you Hazim

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

    Covered all the details...hats off...
    your videos are best in the field.....thanks for uploading...

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

    Hello, Raghav. This video is excellent as others. Thank you.

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

    Many Many thanks from Germany.

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

      Most welcome Rishikesh

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

    QTP/UFT was dominant in automation tool market for almost a decade. In your view, how long Selenium+appium+testNG+etc can stay relevant in the Testing job market?

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

      Hi Jayita, good question, with the current trends it looks like Selenium Appium will stay for some time for sure as they form the core and basis or UI and Mobile automation. Also used as the backend of several other tools and platforms. Having said that, as we are moving towards, RPA (Robotic Process Automation), AI (Artificial Intelligence) and ML (Machine Learning), I will suggest that people should also start looking and learning these to be better prepared for future.

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

    Hello, Raghav. Thanks again for all those knowledges. As a beginner I'm just getting started on my coding journey. It would be awesome if you upload some videos about basic concepts of coding in order to understand your lessons better.

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

      Sure JB, you can find some basic Java here - automationstepbystep.com/online-courses/
      Wish you all the best

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

    Very useful. I like your way teaching

  • @C.Sakthivignesh
    @C.Sakthivignesh Год назад +1

    Thanks sir for made this video.

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

    Brilliant! Thanks

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

    it was easy to understand.thnku sir

  • @poojakumbhar7561
    @poojakumbhar7561 7 лет назад +1

    Hi Raghav...the video is very useful for begineers like me..
    So can we simultaneously learn selenium and Devops tools????as i am a fresher for automation testing but having experience in manual and want to switch to automation

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

      hi Pooja, great to know that it helped you. Yes, you can learn selenium and DevOps together. Do not worry if you have no experience in Automation Testing. Start today go step by step. You can explore the playlist and start learning - ruclips.net/channel/UCTt7pyY-o0eltq14glaG5dgplaylists

    • @poojakumbhar7561
      @poojakumbhar7561 7 лет назад +1

      Thank a lot Raghav,..will be following you for devops tools also..

  • @dominice2171
    @dominice2171 7 лет назад +1

    Thank you for such great tutorials.. :)

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

      I am glad, you liked it. Keep Learning.

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

    Hello Raghav, greetings from Birmingham, UK. I have been watching and closely following your channel from last few days. Your videos are very well structured, thought out and beautifully illustrated and like your style of teaching. Do you have plans to do videos on BDD-Cucumber-Gherkin for Selenium-Java? It would tremendously benefit anyone looking to understand Selenium Test Automation from Behaviour Driver Development using selenium with Java all the way to continuous Integration and version controlling. I believe that you have covered Jenkins and Git in depth already. Again, your work is just incredible.

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

      Hi Mayur, thanks a lot for you message.
      BDD-Cucumber-Gherkin for Selenium-Java is in my To Do list and i will take it up soon.
      Keep watching and learning.

    • @Mayurshiv
      @Mayurshiv 6 лет назад +1

      Thanks for responding and great to know that these are in your to do list Raghav.... yeah off course i am totally subscribed

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

    Raghav, do you also provide technical interview training ?

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

      Hi Sheetal, I usually do training for corporates or groups

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

      Ok Thanks

  • @macsonmanbhat
    @macsonmanbhat 6 лет назад +1

    @raghav Why is execution from the config file required ? When we can achieve browser execution with steps from the previous tutorials

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

      Hi, this is to cover the feature of config file as it is used in many projects. You can select the best way for you.

  • @855chandu
    @855chandu 2 года назад

    im new to java and learning automation. How to develop coding skills in Java like you do? its easy to watch but without watching it, I don't know what classes to invoke and files to use and data to pass in and out of the files.

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

      you have to practice, take some program examples and try daily

  • @Cristina-vg5bi
    @Cristina-vg5bi 3 года назад

    Thank you for the video!

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

      Glad it was helpful!

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

    Hi, Raghav. I had a queries and confusions in using properties file as well as POM class. How do we use both the classes in a Test. It threw error while calling the methods from the POM class but it worked when I used driver.findElement methods for locating the WebElement in my Test class

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

      Hi Papun
      To use both properties file and POM class in a Test class in Selenium Java, you can follow the below steps:
      Create a Properties file: First, create a Properties file to store the web element locators or any other configurations. You can create this file under the resources folder of your project.
      Load the Properties file: In your Test class, you can load the Properties file using the following code:
      Properties prop = new Properties();
      InputStream input = new FileInputStream("src/test/resources/config.properties");
      prop.load(input);
      Here, the config.properties is the name of your Properties file.
      Create an object of your POM class: Once the Properties file is loaded, you can create an object of your POM class in the Test class using the below code:
      HomePage homePage = new HomePage(driver);
      Here, driver is an instance of WebDriver, which should be initialized before using it in the Test class.
      Use WebElement locators from Properties file: To use WebElement locators from the Properties file in your POM class, you can use the below code:
      @FindBy(id = prop.getProperty("username"))
      private WebElement usernameInput;
      Here, username is the id of the input field in your application, and usernameInput is the WebElement object created in your POM class.
      Call the methods from the POM class: Once the WebElement objects are created in your POM class, you can call the methods from the POM class in your Test class as shown below:
      homePage.enterUsername(prop.getProperty("username"));
      Here, enterUsername is the method created in your POM class to enter the username in the input field.

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

    thank you for the beautiful explanations.. if I want to set the URL in the properties file, then how can I proceed for method runtest().

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

      Hi Gulam, so are you able to get the value from properties file in the code. If yes then you can directly use it. Can check this - ruclips.net/video/1GeVbi1uj_8/видео.html

  • @PriyankaKush88
    @PriyankaKush88 7 лет назад

    Very helpful video Raghav......Now suppose I'm defining my TestData excel name in my property files and fetching that excel name in my Class.......but here i'm confused that where will I define the excel path? Can u help me for that or can u plz create another video and upload?

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

      Hi Priyanka. you can definitely define the path in your config and in your code refer it from here. I will soon be creating a more detailed series on selenium framework with java.

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

      Hi Priyanka, I started Selenium Java Framework from scratch series ruclips.net/p/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa

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

    thaaaaaaaank you really it saved me

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

    Hi Raghav, I am follower of your videos. I have 2 questions - 1 ) In this video you showed us how to read data from properties file and how to write in the same file. But when you write in the same file, it deleted everything what it read before. How can i read from the file and write another line in the file not deleting anything from it.
    2 ) I see that you have JOIN button in your video, what is it and what is benefit for it . can you please explain , how it works if I join
    Thanks a lot

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

      Hi Mohammad Bhuiyan,
      1) You can append instead of overwrite.
      stackoverflow.com/questions/17401385/how-to-append-new-data-to-existing-data-in-properties-file
      2) There are some extra perks available to the members of the channel who Join. When you click on Join, you can see all the perks

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

    I don't understand who dislikes these videos

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

      I just it helps millions. Thanks Jose for the message

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

    Hi Raghav! Can you please tell me how to set path for the executable in a config file on macbook

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

      Hi Sujatha, I will check on this, can take some online help too

  • @seenukaniappan8882
    @seenukaniappan8882 7 лет назад

    Thanks For Make It Easy :) Keep

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

    What is the advantage of run the test using properties file

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

      Hi Amrutha, adv here is that you can update values from outside the framework and code. So you do not have to open framework or code and can just open the file on your system update and can then run

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

      @@RaghavPal thank you

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

    Hi Raghav,
    Thanks for the tutorial, when I ran this exercise using properties file, and put browser = chrome in config.properties, it loads the chrome browser, but opens the website in firefox, could you shed your thoughts on this?
    Thanks.

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

      Hi Amitabh, Check your code, you must be having code to run firefox outside the conditional blocl

  • @mohammedzakaria8783
    @mohammedzakaria8783 7 лет назад

    Hi Raghav, thanks for this exciting work, I have a question, every time we call the write mth- it deletes previous records and write new strings, is there any way that we can keep older string and add new objects? Thanks in advance.

    • @RaghavPal
      @RaghavPal  7 лет назад +1

      Hi Mohammed, you can use
      FileOutputStream output = new FileOutputStream(File file, true);
      true is to append instead of overwrite

    • @mohammedzakaria8783
      @mohammedzakaria8783 7 лет назад

      Great, thanks. I have some other things to share with you, can I have ur email address? Thanks again.

    • @RaghavPal
      @RaghavPal  7 лет назад +1

      You can find the email in the about section of the channel.

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

    Do you have any other video on property file as well??

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

      I don't think so, you will find all in this Selenium Playlist

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

    Hi Raghav, your way of explanation was quite easy and understandable.everything was working fine,while exporting runnable jar files something happened, now my code is showing error as" Exception in thread "main" java.lang.Error: Unresolved compilation problem:",please help me out.

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

      Hi Sana, will have to see the compilation issues. Check this stackoverflow.com/questions/1124788/java-unresolved-compilation-problem

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

    When we do getPropertyValue is it compulsory to setPropertyValue also

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

      No it depends, if the value is already existing to fetch you can only do get and if you want to create or update you can do set

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

    Hi Raghav , I tried to run this program but for me it’s printing null instead of giving me the name of the browser

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

      Will have to see your programm

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

      I have the same problem what did you do

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

    Hi Raghav, i don't know why but i am getting class not found exception, tried so many solutions still nit able to find any resolution. Please help

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

      HI Ranjana, will need to see the logs to troubleshoot

  • @PSD-qf7nh
    @PSD-qf7nh 11 месяцев назад

    Hi Raghav Sir
    While trying to get values from config.properties file using InputStream object , at compilation getting error despite following same steps "InputStream cannot be resolved to a type" , Kindly guide . thanks

    • @RaghavPal
      @RaghavPal  10 месяцев назад +1

      Here's a consolidated approach to troubleshoot and resolve the issue:
      1. Import the InputStream Class:
      - Ensure you've added the necessary import statement at the beginning of your Java file:
      ```java
      import java.io.InputStream;
      ```
      2. Verify Classpath Configuration:
      - IDE:
      - Right-click your project and go to Properties (or Build Path) to check if the JRE System Library is correctly referenced.
      - If not, add or re-add it.
      - Command Line:
      - Use `javac -cp ` to specify the classpath during compilation.
      3. Review Code for Typos:
      - Double-check that you've spelled `InputStream` correctly throughout your code.
      - Ensure there are no capitalization errors or other typos.
      4. Check for Conflicting Names:
      - If you have a variable or method named `InputStream` in the same scope, it might conflict with the class.
      - Rename any conflicting identifiers.
      5. Consider IDE-Specific Issues:
      - Project Configuration: Sometimes, IDEs have project-specific settings that might affect compilation.
      - Review your project settings and ensure they're configured correctly for Java development.
      - Clean and Rebuild: Try cleaning and rebuilding your project to refresh any cached information.
      6. Inspect External Libraries:
      - If you're using external libraries that also use `InputStream`, ensure they're included correctly in your classpath.
      - Check for any compatibility issues or version conflicts.
      Additional Tips:
      - Use a Code Analysis Tool: Employ a tool to detect potential errors or code quality issues.
      - Consult Documentation and Examples: Refer to the Java API documentation or online examples for proper usage of `InputStream`.
      - Utilize IDE Troubleshooting Features: IDEs often provide error messages and hints that can guide you towards a solution.

    • @PSD-qf7nh
      @PSD-qf7nh 10 месяцев назад

      Thank you sir , I used ctrl + space for suggestions and it imported the " import java.io.InputStream"
      @@RaghavPal

  • @sumantyadav6641
    @sumantyadav6641 6 лет назад +2

    Voice is very low even after increasing the volume, please improve this.

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

      Sure Sumant, I will take care of audio in future videos. For now, pls see if headphones can help

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

    Hi Raghav I am not getting auto suggestion try catch block and if I try to write manual try block I am getting error So can you help me out .

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

      Hi Subrat, what is the error, pls check the syntax

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

    Hi Raghav, thanks for share your knowledge. I need of you support, I have a mobile project built in serenity bdd-cucumber-java. I have two property files, android.properties and ios.properties with the capabilities for two devices located in Kobiton. I have a test case with two scenarios, the first scenario must take android.properties and the second scenario must take ios.properties. I need to know how I can read each file of those in run time. It doesn´t work for me to read both file for command line.

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

      Hi, I am not much aware on this, will need to get some online help

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

    How to create separate diversetup class and call in main method

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

      Hi, I will try to add a session, can check some online examples meanwhile

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

    Hi Raghav , thanks for the video well and clear explanation but i am having this trouble with writePropertiesFile and this is what i am getting after" The metthod writePropertiesFile() is unidentified for the type of propteiesFile and if i clicked on the Create method writePropertiesFile() i will get a response in the r private static void writePropertiesFile() {, therefore if i run as Java Application , the result will still be "Firefox" instead of "Chrome"

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

      Hi Imo, I believe there is something missing. Can you pls recheck all the steps with the video

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

      @@RaghavPal
      Thanks so much i got that after following the steps
      but on config Properties linked with( FirstSeleniumTest )the console response is this below
      (Chrome
      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpRequestBase
      at test.FirstSeleniumTest.setBrowserConfig(FirstSeleniumTest.java:43)
      at test.FirstSeleniumTest.main(FirstSeleniumTest.java:20)
      Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpRequestBase
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      ... 2 more)
      Kind Regards
      Many Thanks

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

      The logs are not complete, Do you have caused by section in logs

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

    In my case the read properties file is read and printing the data in the config file at the console but remaining two methods i.e; main method(), runtest() in FirstSeleniumTest.Java are not happening...Saying that exception in thread main..Java.lang.NullpointerException. at test.FirstSeleniumTest.runtest
    at test.FirstSeleniumTest.main....

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

      Hi Sriram, will need to see more logs to troubleshoot, check if you find caused by section in logs

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

      @@RaghavPal i don't know how to check logs sir ...But one thing is clear...The runtest() method is throwing an nullpointerexception .

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

      Just check in your console window,

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

      @@RaghavPal done sir...😁

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

      Getting same exception java.lang.nullpointerexeption....from runtest () method... How to solve??

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

    Raghav can you please share some real time interview questions please.

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

      I will do very soon. Thanks for watching

  • @jianzhang1175
    @jianzhang1175 7 лет назад

    Hi Raghav. I follow your step to edit and run the code. But I cannot see the result to display "Firefox".
    It displays error message as following "Error: Could not find or load main class config.PropertiesFile. Caused by: java.lang.ClassNotFoundException: config.PropertiesFile"
    I follow all the exact steps as you did but I can't debug successfully.

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

      Hi Jian, looks like some error in your code. Can you put your code and your file name to debug.

    • @jianzhang1175
      @jianzhang1175 7 лет назад +1

      Yes. Already fixed it. Thanks.

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

      Hi. I got the second issue. When I execute the "FirstSeleniumTest.java" by using the data of browser in the file of "config.properties", the result is different with yours. The Chrome of Firefox browser is not opened. It displays that "Exception in thread "main" java.lang.NullPointerException at test.FirstSeleniumTest.runTest(FirstSeleniumTest.java:48) & at test.FirstSeleniumTest.main(FirstSeleniumTest.java:18)".
      The Line 48 is "driver.get("seleniumhq.org/");" and Line 18 is "runTest();".
      No idea what happened.

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

    With Properties File, when I switch from Firefox(which is working OK) to Chrome I always get "Exception in thread "main" java.lang.NullPointerException" when run the program.
    But when I change from "PropertiesFile.readPropertiesFile();" to be "setBrowserConfig();" to use Chrome, it is working fine.
    I did try some research but couldn't solve this issue.

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

      Hi Werayut, For now, you can put this code in a condition like
      if(browser.equalsIgnoreCase("chrome")){
      setBrowserConfig();
      }
      else if(browser.equalsIgnoreCase("firefox")){
      PropertiesFile.readPropertiesFile();
      }

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

      @@RaghavPal It's working now, May I understand whey .contain won't work with Chrome but Firefox.
      And I just would like to say thank you and I'll be spreading the knowledge I know as well.
      Thank you for your contribution.
      Is there any way I could contact you if I have questions - such as e-mail?

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

      Glad to know it is resolved. I will update if I get more info. RUclips comments is the best place for queries, You will get faster replies here

    • @DeepakMishra-hx7cb
      @DeepakMishra-hx7cb 3 года назад

      Hey, I was getting the same error while switching between the browser (from firefox to chrome and vice versa). I did hit and trials and I found that each time while giving the browser name in the config file, I was writing the first letter of firefox (F) and chrome (C) in the capital letters while in my main class I have put the conditions as
      if(browser.contains("firefox")) {
      //set browsers
      }
      if(browser.contains("chrome")) {
      //set browsers
      }
      I tried by giving the small characters in my browser name in the config file and it worked for me(with .contains). You can also try. If that works for you. Cheers :)

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

    hi, I didnt understand how it is printing the result in the properties file. In writePropertiesFile fxn i have commented the result line,still it is printing. Can you explain me, please

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

      There must be some code doing it. Check it. You can check step by step in debug mode.

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

    Hi Raghav.. I am not able create config.properties file ,i am not getting the option for file when i m trying to create a new file from config package,even i tried by other(Ctrl+N) what can i do?

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

      Hi Sana, this is strange, I hope you are using Eclipse, if you do a right click and select New, do you see others options, Try going there and type file to search for the option.

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

      Hi Raghav ,i am using Eclipse ,till selenium beginners 10 tutorial i have followed the same steps as you,when i select config package and click right and select new ,their i wont see file option ,but when i click others option , it open the select Wizard pop up.

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

      Yes here you can type file in search box and see if you get the option

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

    is it my laptop , the volume is too low. "Never stop learning" by Raghav.

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

      Guzara, It may be with this video, can try using headphones with full volume on device and player
      I will take care in future

  • @sachinumrikar1586
    @sachinumrikar1586 7 лет назад

    Thanks Raghav!
    How this property file read in TestNG program?
    Please explain it.
    Thanks!

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

      Hi Sachin, you should be able to use similar steps. Let me know if there is something specific you need to do.

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

    Hi raghav, need your help how do you just validate with mozilla firefox when you set writeproperties file is for chrome? Please answer.

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

      Hi Kuldeep, did not get you exactly, which part of the video are you referring to.

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

      Automation Step by Step - Raghav Pal you just changed the config.properties and make browser = firefox for validating ?

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

      So I don't understand how does it work ?

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

      Okay, properties file is a file where we can store key value pairs like name=Kuldeep
      And we can read and write values to properties file as shown in the video.
      setProperty and getProperty are the functions with which we can write and read data

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

      Hi Raghav, i need to automate a login page so how do i do ? do you have any video related to that !

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

    Sir is properties file created automatically when java is installed

  • @artasilidan
    @artasilidan 7 лет назад

    Hi Raghav, thanks for your videos! I'm facing the strange issue, namely when I run FirstSelenuimTest.java with
    setBrowser();
    setBrowserConfig();
    runTest();
    functions it's runnig well and browser opens, but if I use
    PropertiesFile.readPropertiesFile();
    setBrowserConfig();
    runTest();
    PropertiesFile.writePropertiesFile();
    nothing happens besides the fact it displays the current value of browser from properties file (correctly), which means it can read it, and also my System.out.println("Executed") which I put to writePropertiesFile method. But then I'm wondering why other commands 2 commands in between are not executed :/ Did exactly like you did the rest. Thanks for your help!

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

      Hi Vadym, looks like issue fetching from properties file. It will be difficult to troubleshoot without logs. You can put breakpoints and check in debug mode.

    • @artasilidan
      @artasilidan 7 лет назад

      Hi Raghav,
      Unfortunately, still no luck, debug mode didn't return any error. The strange thing is that when I put writePropertiesFile at first in main of FirstSelenuimTest and then setBrowserConfig(); and runTest(); as 2nd and 3rd respectively, it works, but if I'm trying to put first PropertiesFile.readPropertiesFile(); in order to actually read the value tiped in prop file and put it to variable "browser", it reads but doesn't run Firefox or Chrome. Look, I even put it to display if it actually reading correctly the value "browser" from Prop file and if it actually writes it to my browser variable:
      if (PropertiesFile.prop.getProperty("browser") == "Firefox") {
      System.setProperty("webdriver.gecko.driver", "/Users/admin/Documents/workspace/Selenium test/lib/geckodriver/geckodriver");
      System.setProperty("webdriver.firefox.bin", "/Applications/Firefox.app/Contents/MacOS/firefox-bin");
      driverFirefox = new FirefoxDriver();
      System.out.println("OKFirefox");
      }
      else {System.out.println(browser);} //it always returns me this value as "Firefox" but then this "if" is not being
      executed inside setBrowserConfig()
      Would you mind if I send you my code just to test on your machine? Because I tried to modify it in so many ways just to make sure that each and every step works but if I want to set the vlue in prop file and run the test accordingly it doesn't work though. Thanks in advance!

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

      I know it's a little late for this, but I think it's because you need to use .equals("Firefox") instead of == on your if statement.

  • @delfin1231000
    @delfin1231000 7 лет назад

    Hello! )) Please, could you please make video to upload the file with Jmeter?

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

    Do you conduct online courses?

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

      Hi Roopali, yes I do on need basis

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

      Can you please send your email address so I can communicate further. Thanks.

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

      sure, raghav.qna@gmail.com

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

    When I run the same... Output came Exception in thread "main" Chrome
    Java. Lang. NullpointerException
    at projectconnect. Demo. runTest(Demo.java:55)
    at projectconnect. Demo. runTest(demo.java.26)
    Please help me

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

      Hi Abhi, can you check the code line where this error is thrown and show the same

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

    SUPERLIKE

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

      Thanks for watching Rashmi.

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

    What is the meaning of input stream class ?

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

      Hi Helly, This class helps to read data or get any inputs. You can find more examples online

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

    Hi Raghav, I'm trying to get property value from config.properties but getting NullPointerException .
    Created one constructor in the same class where have intialized property,Inputfilestream..etc then in the same class have one method in which trying to call prop.getproperty("browser") but getting nullpointerexception.Please help, if possible please share your email Id want to share the code.Thanks.

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

      Hi Suhanini, look for the following
      1. the path you are referring is correct?
      2. The name of the file is correct?
      3. Name (spelling + cases) of the property is correct

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

    This was a great video fore sure, but it wasn't that easy to understand. It's challenging and confusing at the same time.

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

      Hi James, pls let me know the issues you faced. Also this is a video from a playlist. I hope you have watched the earlier videos. Here is the link
      ruclips.net/p/PLhW3qG5bs-L_s9HdC5zNshE5Ti8jABwlU
      ruclips.net/p/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa

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

      Same here. I also took long to understand it. But finally made it. Thanks Raghav.

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

    getting two errors. my code is
    package config;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.InputStream;
    public class Properties {
    public static void main(String[] args) {
    read();
    }
    public static void read() {
    Properties prop = new Properties();
    try {
    InputStream input = new FileInputStream("/Users/a-4600/eclipse-workspace/SeleniumJavaProject/src/config/config.properties");
    prop.load(input);
    System.out.println(prop.getProperty("browser"));
    }
    catch (Exception e) {
    e.printStackTrace();
    }
    }
    }
    // here prop.load(input) throws error 'The main load(InputStream) is undefined for the type Properties
    // getProperty("browser") also throws same error.
    Can you please help me?

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

      Hi Shaji, can you recheck from the video did I create a class called Properties as you have done. I doubt this. Pls recheck

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

      @@RaghavPal oh OK. I changed the class name from Properties to PropertiesFile as you done in your video and code worked fine. Thanks :-)
      Meanwhile, what is the technical issue in creating a class named 'Properties' ? was there any conflict with any inbuilt function?

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

      Properties is already a class in the library

  • @ajaykumar-gz8df
    @ajaykumar-gz8df Год назад

    Hi Raghav,
    I am unable to run properies files , in connsole it showing blank, please once look int this
    package config;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.util.Properties;
    public class ProportiesFile {
    public static void main(String[] args) {
    readpropertiesfile();
    }
    public static void readpropertiesfile(){
    }
    Properties prop = new Properties();{
    try {
    FileInputStream input = new FileInputStream("Users/ajayk/eclipse-workspace/SeleniumAutomation/src/config/config.proporties");
    prop.load(input);
    System.out.println(prop.getProperty("browser"));
    }
    catch (Exception e) {
    e.printStackTrace();
    }
    }
    }

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

      Ajay
      The issue with the provided code is that the `Properties` object is being instantiated within an initializer block, which is causing the `prop.getProperty("browser")` statement to print a blank value. This is because the initializer block is executed before the `readpropertiesfile()` method is called, and the `FileInputStream` object is not created until the `try-catch` block inside the `readpropertiesfile()` method.
      To fix this issue, you need to move the code to create the `FileInputStream` object and load the properties into the `prop` object inside the `readpropertiesfile()` method. Here's the corrected code:
      ```java
      package config;
      import java.io.FileInputStream;
      import java.io.FileNotFoundException;
      import java.util.Properties;
      public class PropertiesFile {
      public static void main(String[] args) {
      readPropertiesFile();
      }
      public static void readPropertiesFile() {
      Properties prop = new Properties();
      try {
      FileInputStream input = new FileInputStream("Users/ajayk/eclipse-workspace/SeleniumAutomation/src/config/config.properties");
      prop.load(input);
      System.out.println(prop.getProperty("browser"));
      } catch (Exception e) {
      e.printStackTrace();
      }
      }
      }
      ```
      In this corrected code, the `Properties` object is created and initialized inside the `readPropertiesFile()` method, ensuring that the `prop.getProperty("browser")` statement has access to the loaded properties.

    • @ajaykumar-gz8df
      @ajaykumar-gz8df Год назад

      Hi @@RaghavPal
      I am Unable to find the properties file location, Already I am created propertiesfile but still I am getting this Issue .
      java.io.FileNotFoundException: Users\ajayk\eclipse-workspace\SeleniumAutomation\src\config\config.properties (The system cannot find the path specified)
      at java.base/java.io.FileInputStream.open0(Native Method)
      at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
      at java.base/java.io.FileInputStream.(FileInputStream.java:157)
      at java.base/java.io.FileInputStream.(FileInputStream.java:111)
      at config.PropertiesFile.readPropertiesFile(PropertiesFile.java:17)
      at config.PropertiesFile.main(PropertiesFile.java:10)

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

      The error message indicates that the Selenium Java code is trying to load a properties file from the location `Users\ajayk\eclipse-workspace\SeleniumAutomation\src\config\config.properties`, but the file cannot be found.
      There are a few possible reasons why this might happen:
      * The properties file does not exist at that location.
      * The properties file exists, but the Selenium Java code does not have permission to read it.
      * The path to the properties file is incorrect.
      To troubleshoot the issue, you can try the following:
      1. Make sure that the properties file exists at the location `Users\ajayk\eclipse-workspace\SeleniumAutomation\src\config\config.properties`. If the file does not exist, you will need to create it.
      2. Make sure that the Selenium Java code has permission to read the properties file. You can do this by checking the file permissions.
      3. Check the path to the properties file in the Selenium Java code to make sure that it is correct.
      If you are still unable to resolve the issue, you can try the following:
      * Try running the Selenium Java code from the command line. This can help to rule out any problems with your Eclipse workspace.
      * Try using a different properties file. This can help to rule out any problems with the properties file itself.
      * Try using a different version of Selenium Java. This can help to rule out any problems with the Selenium Java library itself.
      If you are still unable to resolve the issue, you can post a question on Stack Overflow or another Selenium forum.
      Here are some additional tips for working with properties files in Selenium Java:
      * Make sure that the properties file is in the classpath. This means that it should be in the same directory as your Selenium Java code, or in a subdirectory of the classpath.
      * Use the `Properties` class to load the properties file. This class provides a number of methods for reading and writing properties files.
      * Use the `System.getProperty()` method to get the value of a property. This method takes the name of the property as a parameter and returns the value of the property, or `null` if the property does not exist.
      Here is an example of how to load a properties file in Selenium Java:
      ```java
      import java.io.FileInputStream;
      import java.io.IOException;
      import java.util.Properties;
      public class PropertiesExample {
      public static void main(String[] args) throws IOException {
      // Load the properties file
      Properties properties = new Properties();
      properties.load(new FileInputStream("config.properties"));
      // Get the value of a property
      String username = properties.getProperty("username");
      // Do something with the username
      System.out.println("Username is: " + username);
      }
      }
      ```
      I hope this helps