Selenium Cucumber Java BDD Framework 6 - Page Object Model | Step by Step

Поділитися
Вставка
  • Опубліковано 22 лип 2024
  • QUIZ - forms.gle/khk3hsLVUtY5qAcDA
    FREE - automationstepbystep.com/
    Today we will learn:
    1 - What is POM - Page Object Model
    2 - Advantages of POM
    3 - How to implement POM in Selenium Cucumber Framework
    What is POM
    Design pattern to create Object Repository
    A class is created for each page to identify web elements of that page
    Also contains methods to do action on the objects
    Separates test objects and test scripts
    Step 1 - Create a class for each page
    Step 2 - Create locators of all objects to be used in that page
    Step 3 - Create methods or actions to be performed on the objects
    Step 4 - Refer in the test scripts
    Step 5 - Run and validate
    Join this channel to get access to perks: ua-cam.com/users/automationste...
    Hit Like and. Subscribe button, if you like this video. It gives me great motivation.
    You can support my mission for education by sharing this knowledge and helping as many people as you can
    If my work has helped you, consider helping animalaidunlimited.org/ or any animal welfare group near you, in any way you can.
    _______ ONLINE COURSES TO LEARN _______
    automationstepbystep.com/onli...
    Udemy Discounts - automationstepbystep.com/udem...
    GitHub - github.com/Raghav-Pal/
    Udemy - www.udemy.com/user/raghav-pal-3/
    Training by Raghav at your venue - raghav.qna@gmail.com
    Training schedule - automationstepbystep.com/trai...
    ----------- UI TESTING -----------
    Selenium Beginners - bit.ly/2MGRS8K
    Selenium Java Framework from Scratch - bit.ly/2N9xvR6
    Selenium Python - bit.ly/2oyMp5x
    Selenium Tips - bit.ly/2owxc50
    Selenium Builder - bit.ly/2MKNtlq
    Katalon Studio - bit.ly/2wARFdi
    Robot Framework with RIDE- bit.ly/2Px6Ue9
    Robot Framework with Eclipse - bit.ly/2N8DZxb
    Protractor - bit.ly/2KtqVkU
    TestProject - bit.ly/2DRNJYE
    ----------- API TESTING -----------
    Web Services (API) - bit.ly/2MGafL7
    SoapUI - bit.ly/2MGahmd
    Postman - bit.ly/2wz8LrW
    General - bit.ly/2PYdwmV
    Katalon Studio API Testing - bit.ly/2BwuCTN
    ----------- MOBILE TESTING -----------
    Appium - bit.ly/2ZHFSGX
    Mobile Playlist - bit.ly/2PxpeUv
    ----------- CI | CD | DEVOPS -----------
    Jenkins Beginner - bit.ly/2MIn8EC
    Jenkins Tips & Trick - bit.ly/2LRt6xC
    Docker - bit.ly/2MInnzx
    Kubernetes - bit.ly/2MJIlMK
    ------------VIRTUALISATION------------
    Virtualization on windows - bit.ly/2SItIL9
    ----------- VERSION CONTROL SYSTEM -----------
    Git & GitHub - bit.ly/2Q1pagY
    GitLab - bit.ly/2kQPGyQ
    ----------- PERFORMANCE TESTING -----------
    JMeter Beginner - bit.ly/2oBbtIU
    JMeter Intermediate - bit.ly/2oziNVB
    JMeter Advanced - bit.ly/2Q22Y6a
    JMeter Tips & Tricks - bit.ly/2NOfWD2
    Performance Testing - bit.ly/2wEXbLS
    ----------- PROGRAMMING -----------
    Java Beginners - bit.ly/2PVUcXs
    Java Tips & Tricks - bit.ly/2CdcDnJ
    GROOVY - bit.ly/2FvWV5C
    JAVASCRIPT - bit.ly/2KJDZ8o
    PYTHON - bit.ly/2Z4iRye
    ----------- IDE -----------
    Visual Studio Code - bit.ly/2V15yvt
    ----------- BUILD TOOLS -----------
    Maven - bit.ly/2NJdDRS
    Gradle - bit.ly/30l3h1B
    ----------- OTHERS -----------
    Redis- bit.ly/2N9jyCG
    Misc - bit.ly/2Q2q5xQ
    Tools & Tips - bit.ly/2oBfwoR
    QnA Friday- bit.ly/2NgwGpw
    Sunday Special - bit.ly/2wB23BO
    Ask Raghav - bit.ly/2CoJGWf
    Interviews - bit.ly/2NIPPxk
    All Playlists - bit.ly/2LSiezA
    Keep Learning,
    Raghav
    ---------- Connect with Raghav -----------
    Website - automationstepbystep.com/
    LifeCharger - lifecharger.org/
    Udemy Courses - www.udemy.com/user/raghav-pal-3/
    Facebook - / automationstepbystep
    Twitter - / learnwithraghav
    UA-cam - / automationstepbystep

КОМЕНТАРІ • 186

  • @rishashanth1560
    @rishashanth1560 3 роки тому +3

    Thank You so much for the detailed lectures. I would say this is one of the best tutorials and you made it accessible to everyone. Thanks!

    • @RaghavPal
      @RaghavPal  3 роки тому

      You're very welcome Risha

  • @chicku975
    @chicku975 2 роки тому +9

    I had doubt regarding the logic behind the driver initialization in POM. I watched several Udemy videos from different Gurus but it did not get cleared. But after 1 year, I stumbled upon this video and my doubt got resolved within seconds after watching this video. Cannot believe how easily and detailed he explained the concept. Thanks a lot Raghav. Your contents are great.
    Keep doing what you do and keep helping the needy souls like us.

    • @RaghavPal
      @RaghavPal  2 роки тому

      So happy & humbled to see your message Shachindra

  • @786Muhaimin
    @786Muhaimin 4 роки тому +2

    Another great video! Looking forward to the next one!

  • @mani123ish
    @mani123ish 2 роки тому

    You have explained every concept in details .Really appreciate your efforts.

  • @mayankjain9941
    @mayankjain9941 4 роки тому +1

    Nicely explained Page Object Model, Easy to understand. Thanks, Raghav!!

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      You're welcome Mayank

  • @raajijeeru1972
    @raajijeeru1972 3 роки тому

    Such a wonderful explanation and Great work Sir. Always love your explanations.

    • @RaghavPal
      @RaghavPal  3 роки тому

      Glad to hear that Raaji

  • @IfNotMe
    @IfNotMe 2 роки тому +1

    I learned more here than anywhere else...Thank you for your efforts

    • @RaghavPal
      @RaghavPal  2 роки тому

      So nice of you Shakeel, humbled

  • @srikanthbolisetty1417
    @srikanthbolisetty1417 4 роки тому

    Thanks for the session, easy to understand!

  • @anishgupta7234
    @anishgupta7234 Рік тому

    Superb way to explain , i really liked the way he teaches miltiple things in one go with smoothness

  • @phindilehlungwana
    @phindilehlungwana 3 роки тому

    Thank you so much for all the demonstrations

    • @RaghavPal
      @RaghavPal  3 роки тому +1

      You are so welcome Phindile

  • @jorge4932
    @jorge4932 2 місяці тому

    Your page and courses are brutal !! Congratulations Raghav!!
    Thank you very much to share with us all of your knowledge!!

    • @RaghavPal
      @RaghavPal  2 місяці тому

      Glad you like them Jorge

  • @adityachoudhary2101
    @adityachoudhary2101 3 роки тому

    Thank you so much Raghav, this video helps a lot to develop UI framework using Java oops concept...Thanks a lot

  • @user-rm5pw9zn9g
    @user-rm5pw9zn9g 6 місяців тому

    You're the best! Thank you for such a great explanation.

    • @RaghavPal
      @RaghavPal  6 місяців тому

      Most welcome Elmira

  • @rahuldubey9013
    @rahuldubey9013 3 роки тому

    Really appreciate the effort. You make it easy.

  • @suchishah8332
    @suchishah8332 2 роки тому

    Again awesome and useful explanation .Thank you so much.

  • @syedasif4207
    @syedasif4207 Рік тому

    Hi raghav...all the video tutorials are very clear to understand and follow. May God bless you bro.

  • @susmithakotla3431
    @susmithakotla3431 2 роки тому

    Thanks a lot for making this concept very easier.

  • @Mushsayer
    @Mushsayer Рік тому +1

    Awesome training videos!

  • @mohammadtajuddin7115
    @mohammadtajuddin7115 3 роки тому

    Your way of explanation is simply superb👍☺️💐💐💐💐💐💐💐💐💐

  • @keshavKumar-le4df
    @keshavKumar-le4df Рік тому

    One of the best video to learn automation.

  • @sadizeggane4792
    @sadizeggane4792 3 роки тому

    BIG BIG BIG BIG BIG BIG BIG Thanks to you mister Raghav :) !!!

  • @alejandrodiazo6526
    @alejandrodiazo6526 Рік тому

    ¡Gracias!

    • @RaghavPal
      @RaghavPal  Рік тому

      muchas gracias por el soporte

  • @NeelamGupta-nh3rh
    @NeelamGupta-nh3rh Рік тому

    Thanks for sharing this concept

  • @hardikkidschannelmspb8304
    @hardikkidschannelmspb8304 3 роки тому

    Very explainatory!!👍

    • @RaghavPal
      @RaghavPal  3 роки тому

      Glad it was helpful Hardik

  • @revansiddappapanchal2068
    @revansiddappapanchal2068 2 роки тому

    you are genius sir, your teaching was excellence

  • @thomasjohn3955
    @thomasjohn3955 2 роки тому

    Thank You. Very useful video

    • @RaghavPal
      @RaghavPal  2 роки тому

      You are welcome Thomas

  • @navikasspecials3112
    @navikasspecials3112 3 роки тому

    Hello Raghav, i like your videos, they are simple and very understandable. and i have gone through your website... there are lot of videos. i request if you add the course in document format that helps us more a lot.

    • @RaghavPal
      @RaghavPal  3 роки тому

      Sure Mounika, thanks for watching

  • @warlordsquerk5338
    @warlordsquerk5338 3 роки тому

    Thank you for the video :)

  • @akshayturkar4004
    @akshayturkar4004 11 місяців тому

    Thanks a lot Sir... you are great

    • @RaghavPal
      @RaghavPal  11 місяців тому

      Most welcome Akshay

  • @manikantan2457
    @manikantan2457 4 роки тому +1

    Very Nice ! Sirji

  • @emirgundem6154
    @emirgundem6154 Рік тому

    Thank you so much raghav

  • @aasraful
    @aasraful 2 роки тому

    Thanks a lot

    • @RaghavPal
      @RaghavPal  2 роки тому +1

      Most welcome Asraful

  • @sumithra576
    @sumithra576 3 роки тому +1

    Hello Raghav,
    I really liked the way how you organized the content and explained the concepts in lay man terms so any enthusiast can understand. Kudos to you on that. I was searching for the BDD framework content and came across your video playlist and I am glued to the content.
    When we run a feature file how did it know which java file to execute? We did not mention the dependency or sort of link any where. I see you some times comment the similar ones so the cucumber does not get confused which one to pick. Say for example all the .java are very different ones. then you cannot always comment the code and execute in a project right? So how do we handle such cases?

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Sumithra, glad to know you are enjoying this series. In general, we an provide the location of the glue code in Cucumber Runner class as you must have seen in the videos, It checks for the matching step definition with the steps of feature file and runs those functions.

  • @ankitshrivastava1772
    @ankitshrivastava1772 3 роки тому +1

    Hello Raghav, in the StepDef and Feature folders we have multiple Feature & stepDef file but when you when you do right click and select the run as cucumber feature then it execute the same stepDef file i mean hoe it binds the Feature file + step Def file.

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Ankit, it basically binds with the statements in given, when, then keywords and finds the corresponding func in any of the step def files. You can also add to check a specific file in the Cucumber Runner

  • @saxenahimanshu6584
    @saxenahimanshu6584 8 місяців тому

    Best relation explained for driver and this.driver page and steps classess

    • @RaghavPal
      @RaghavPal  8 місяців тому

      Thanks for the comment Himanshu

  • @shridharpp
    @shridharpp 4 роки тому +1

    Hi Raghav, please consider making a detailed tutorial on GEB, Spock, Groovy as well.

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Sure I will Shridhar

  • @tanveersyed1049
    @tanveersyed1049 4 роки тому

    Raghav nice video ...Very clear concept ....Pls make video on cucumber interview questions

  • @sivasakthiganesh1469
    @sivasakthiganesh1469 4 роки тому

    Thanks great

  • @saleemeee1
    @saleemeee1 Рік тому

    Hi Rahul, may i know how are you getting the rectangle red box to highlight the text or field or a button when you drag the cursor on them.

    • @RaghavPal
      @RaghavPal  Рік тому

      its screen annotation Saleem

  • @ruthmariahangelinprakash2359
    @ruthmariahangelinprakash2359 2 роки тому +1

    Thank you for the series of the videos on Selenium, cucmber, bdd. These video are very helpful and useful materials in learning the automation. I have couple of doubts. 1. If we need to run from the TestRunner class, do we need to include another glue code for the mapping of step definition with page file. 2. And could you please host few videos on database automation (DB testing). Thank you once again!

    • @RaghavPal
      @RaghavPal  2 роки тому

      Hi, the same glue code should work, I will add videos on db automation testing

    • @ruthmariahangelinprakash2359
      @ruthmariahangelinprakash2359 2 роки тому

      @@RaghavPal Thank you very much on the reply, just a small query if the page file is in another folder then do we need to include another line for the glue code. And awaiting for the DB automation videos. Thank you once again.

  • @roquetony
    @roquetony 2 роки тому

    Hi Raghav! Your videos are wonderful! Thank you so much for sharing your Knowledge with Selenium Cucumber Java BDD. Is there by any chance you can also share how to set an automated screenshot with executed time and date as filename? Again, thanks a lot!

    • @RaghavPal
      @RaghavPal  2 роки тому +1

      I will check and plan for it Tony, thanks for watching

  • @virulekkihal5537
    @virulekkihal5537 Рік тому

    Super 👍

  • @mohdjaveedali7336
    @mohdjaveedali7336 4 роки тому

    Very useful session

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Thanks for liking Javeed

  • @tapaskhandai
    @tapaskhandai Рік тому

    Hi Raghav, why we used login = new LoginPage(driver); in enter username and password method but not in click method below that?

    • @RaghavPal
      @RaghavPal  Рік тому +1

      this is to call the LoginPage class and send the driver parameter to its constructor and refer it with login, once this is done, now you can use login object to access LoginPage functions and properties

  • @amitbhardwaj7824
    @amitbhardwaj7824 3 роки тому

    nice video keep uploading

    • @RaghavPal
      @RaghavPal  3 роки тому

      Thank you, I will Amit

  • @hassellvinny
    @hassellvinny 11 місяців тому

    Great explanation of the POM Raghav, thank you! Can I please ask, how do you do the cursor drag highlighting at 3:43? That looks like a really useful tool for presentations.

    • @RaghavPal
      @RaghavPal  11 місяців тому +1

      Vinny
      you can use annotation tools based on your OS

  • @ParagOak
    @ParagOak 4 роки тому +1

    Can we create any generic RestAssured framework which will be used any project like selenium projects.
    If yes, can you please guide us on this.

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Hi Parag, you can, RestAssured is a java library that you can add and use in any java project

  • @mehmetakifgunder8499
    @mehmetakifgunder8499 2 роки тому

    Hi Raghav. thank you very much. is the "pom" the best model in the testing field. in the example in this video, you used the functions and locators on the same page, but it is more advantageous to use the functions in common in the bdd system. how true is that? but now we use the common function and keep all the locators in a separate field. if there is a link to the latest example in this field, can you share it?

    • @RaghavPal
      @RaghavPal  2 роки тому

      Hi Mehmet, POM design says to separate the objects & actions from the test scripts. So we need to keep our objects and methods separately in a diff class and we can create one class per page of the applications, Now in that class it depends if we also need to separate all object locators at the top OR keep all locators in a separate file and refer from there
      If we have lots of objects and we do not want to give access of class to everyone in QA team, then having a separate file for object locators is good option

  • @shankarmedhi8074
    @shankarmedhi8074 3 роки тому

    so nice

  • @dheerajsingh6568
    @dheerajsingh6568 4 роки тому +1

    Great vidoe Raghav.... One thing I want to know is why you are running feature file only ?? Why not test runner file sir ??

    • @RaghavPal
      @RaghavPal  4 роки тому +2

      Hi Dheeraj, in the first video I have shown about TestRunner file. After all setup and test creation is done, we finally will be using test runner file. Here I am just focussing on POM concept. I will show all other ways of execution, once all features are done

  • @trytobesmart8840
    @trytobesmart8840 3 роки тому

    Very nicely explained.can you plz make video how to read data from excel write excel in cucumber using datatables

  • @NRNov16
    @NRNov16 Рік тому +2

    Why we are creating constructor ?
    Can you briefly explain the use case of constructor here Sir?

    • @RaghavPal
      @RaghavPal  Рік тому +1

      Hi Vipin, sure, Constructor is a function in a class having the same name as class and it is always called whenever the class is instantiated or an object is created for the class.
      Even if you do not explicitly create a constructor function, a default constructor is always present and is called,
      We make use of this feature to force user to send some input parameters when creating objects for a class by creating parameterized constructors

    • @NRNov16
      @NRNov16 Рік тому

      @@RaghavPal Thanks sir

  • @MaryNouri
    @MaryNouri Рік тому

    Hi, i watched your video and that was so great. but i have a problem when i run login demo test project. can you help me and guid me?

    • @RaghavPal
      @RaghavPal  Рік тому

      Hi Mary,
      will need more details on the issue you are facing and steps you have done

  • @sendmereferral5916
    @sendmereferral5916 3 роки тому +1

    HI Raghav, In current video you explain the concept with 1 step and page file.
    Could you please explain the concept where we have more than 1 pages and steps, so that we have shared driver and objects.
    Like: LoginPage, Home Page and customer add page etc.
    So how we are going to have shared driver and objects.
    Please explain this concept.

    • @RaghavPal
      @RaghavPal  3 роки тому

      I will add on that

    • @sendmereferral5916
      @sendmereferral5916 3 роки тому

      @@RaghavPal Thanks.. Please do give me video link.. will be waiting for the same.

  • @abhilash6200
    @abhilash6200 Рік тому

    Hi Sir, thanks for the video it really helps... I am using cucumber >6.8.1 junit 4.13.0 and springboot... When executed my tests are not running... Tests 0...if I downgrade the version it works... Could you please help me

    • @RaghavPal
      @RaghavPal  Рік тому

      Hi Abhilash, not sure if there are some changes in the new version, will need to check online

  • @sendmereferral5916
    @sendmereferral5916 3 роки тому

    HI.. I am looking for Selenium POM framework from scratch but without page factory.. Can you please guide me over the same. Thanks

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi, you can just skip the POM sessions, the concepts will be the same

  • @archananair3819
    @archananair3819 3 роки тому

    Hi Sir, I have a doubt.. Why you created a separate void method in login class page at the bottom? Is that necessary? Why it is used?

    • @RaghavPal
      @RaghavPal  3 роки тому

      Where exactly Archana? can point the time in the video. In case it is empty can avoid it

  • @konarkism
    @konarkism 3 роки тому

    Hi Raghav, I must say you explain very well.. just small question - how will a feature file know that which step definition file it has to execute/refer?

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Konark, it will check the folder you have given as glue code and will take up the function with matching annotations in any of the scripts present in that folder

    • @konarkism
      @konarkism 3 роки тому

      @@RaghavPal yeah, exactly, so I may have multiple step definitions classes present in that folder and classes may have same annotation such as given when and then for many methods, how will it know which particular method of a particular step definition class it has to pick?
      Is there regular expression playing a key role?

  • @08is014
    @08is014 3 роки тому

    Hi Raghav,
    Have one confusion. Logout button is part of Home Page but it's declared in Login Page class.

    • @RaghavPal
      @RaghavPal  3 роки тому

      Ok, that may be a mistake, Pls correct at your end

  • @lauragraham2264
    @lauragraham2264 3 роки тому

    The POM tutorials in Java Selenium worked well, but this one -- it kept inputting the username and password together in the username input slot, even though I had accurate By declarations for both username and password, which worked in the non-POM java. Strange....

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Laura, pls check the object locators you have used in script. I doubt they both are pointing to one object. If required add some wait time in between

  • @imsaurabh73
    @imsaurabh73 2 роки тому

    Hi Raghav one question if we have more than one step defn file how can we maintain same session?

    • @RaghavPal
      @RaghavPal  2 роки тому

      Hi Saurabh, I did not get your exact requirements, what and why you want to have multiple step definition files, for test data you can use files or data table

  • @shivkumardubey1890
    @shivkumardubey1890 3 роки тому

    Raghav I have one doubt after running the test what I'm observing in your video as well in my laptop 2 scenario 2 failed...what does that mean??

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Shiv, there must be some error or failure. I will check again

    • @shivkumardubey1890
      @shivkumardubey1890 3 роки тому +1

      @@RaghavPal yes please Raghav because i have doubt like our scenario is covering what we want to acheive but in pass/ fail result it is showing fail.

  • @vijayakrishna5274
    @vijayakrishna5274 3 роки тому

    Hi Raghav, I am not able to pass the integer while reading the data file(Examples) in cucumber file ,
    It shows me an error ,
    @When("user enter vij@gmail.com and {int}")
    public void user_enter_vij_gmail.com_and(Integer int1) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
    }
    @When("user enter test@gmail.com and abc@{int}")
    public void user_enter_test_gmail.com_and_abc(Integer int1) {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
    }
    what is the error here ,

    • @RaghavPal
      @RaghavPal  3 роки тому

      What is the error thrown Vijaya

  • @praveenl4162
    @praveenl4162 4 дні тому

    Hi getting error compound classes not permitted please help (PAge object model)

    • @RaghavPal
      @RaghavPal  4 дні тому

      Praveen
      Let's break down the problem step by step:
      Step 1: Understand the error message
      The error message "compound classes not permitted" typically occurs when Cucumber encounters multiple classes with the same name in the same package. This is not allowed in Java, as it can lead to ambiguity and conflicts.
      Step 2: Check your Page Object classes
      Review your Page Object classes and ensure that you don't have multiple classes with the same name in the same package. For example, if you have a `LoginPage.java` class, make sure you don't have another class with the same name in the same package.
      Step 3: Check for duplicate classes in your project
      Search your entire project for duplicate classes with the same name. You can use your IDE's search functionality or run a command like `find. -type f -name "*.java"` (on Linux/macOS) or `dir /s /b *.java` (on Windows) to search for Java files with the same name.
      Step 4: Check your step definition classes
      Verify that your step definition classes (e.g., `LoginSteps.java`) are not duplicating any Page Object class names.
      Step 5: Check your glue code
      If you're using a glue code file (e.g., `GlueCode.java`) to bind your step definitions to your Page Object classes, ensure that you're not accidentally creating duplicate classes or methods.
      Step 6: Review your Cucumber configuration
      Check your `cucumber.properties` or `cucumber.yml` file (depending on your Cucumber version) to ensure that you haven't accidentally configured Cucumber to scan multiple packages with duplicate class names.
      Step 7: Clean and rebuild your project
      Try cleaning and rebuilding your project to ensure that there are no stale class files or compilation issues.
      Step 8: Verify your Java and Cucumber versions
      Make sure you're using compatible versions of Java and Cucumber. You can check the Cucumber documentation for compatible versions.
      -

  • @manishkannamoney7455
    @manishkannamoney7455 10 місяців тому

    Excellent explanation sir! But u didn't mention about required depenencies in last class. So, Please could suggest dependencies are needed to add for POM? Thanks in Advance sir

    • @RaghavPal
      @RaghavPal  9 місяців тому

      I will check and add Manish

    • @manishkannamoney7455
      @manishkannamoney7455 9 місяців тому

      @@RaghavPal I required Support. Please can u give?

    • @RaghavPal
      @RaghavPal  9 місяців тому

      Please let me know

  • @deepakhire4970
    @deepakhire4970 9 місяців тому

    Please make a video on page object model with playwright in BDD framework

    • @RaghavPal
      @RaghavPal  9 місяців тому

      I will plan Deepak

  • @julikumari1970
    @julikumari1970 Місяць тому

    what's the difference between 'Page factory' and 'By txt_username=By.is(.....);' in identifying the element.

    • @RaghavPal
      @RaghavPal  Місяць тому +1

      Juli
      Let's explore the difference between Page Object Model (POM) and Page Factory in Selenium for identifying web elements:
      1. Page Object Model (POM):
      - Design Pattern: POM creates an object repository for storing web elements.
      - Class Structure: Each web page is represented as a separate class file.
      - Advantages:
      - Easy Maintenance: When UI elements change, POM helps identify the specific page or screen to modify.
      - Code Reusability: Test code for one screen can be reused in other test cases.
      - Readability and Reliability: Independent Java files for each screen allow efficient code changes.
      - Implementation:
      - Define a separate Java class for each page/screen.
      - Include UI elements and operations specific to that page.
      - Use these classes to perform actions on the website under test.
      2. Page Factory:
      - Class Provided by Selenium WebDriver: Page Factory supports Page Object Design patterns.
      - @FindBy Annotation: Instead of using `FindElement` or `FindElements`, Page Factory uses the `@FindBy` annotation.
      - Implementation:
      - Annotate web elements using `@FindBy`.
      - Initialize web elements using the `initElements` method.
      - Descriptive annotations make it easier to locate and declare web elements.
      In summary, POM focuses on organizing web elements into separate classes, while Page Factory simplifies element initialization using annotations. Both approaches enhance test case maintenance and readability. Choose the one that best suits your project needs
      --

  • @chinmaysatapathy489
    @chinmaysatapathy489 4 роки тому +1

    Can you please use tesng in this framework ?

    • @RaghavPal
      @RaghavPal  4 роки тому

      I will have a session on that Chinmay

  • @kumarsahil2706
    @kumarsahil2706 2 роки тому

    Can u check in the console it is showing like
    2 scenarios (2 failed)
    10 steps ( 2 failed, 8 passed)
    Why it is showing like 2 failed???

    • @RaghavPal
      @RaghavPal  Рік тому

      Hi Sahil, will need to check your tests and logs

  • @sweetthirty2
    @sweetthirty2 2 роки тому

    Hii please make a video on BDD/cucumber folder-package structure

    • @RaghavPal
      @RaghavPal  2 роки тому

      Sure, I will plan Samir

  • @ratishnair4523
    @ratishnair4523 8 місяців тому

    Sir, In above video, data driven testing using excel is not shown, do you have video of data driven using excel ?

    • @RaghavPal
      @RaghavPal  8 місяців тому

      I will check and plan on this Ratish

    • @ratishnair4523
      @ratishnair4523 8 місяців тому

      @@RaghavPal, thanks for reply sir

  • @ss60329
    @ss60329 2 роки тому

    loved the video. easy and to the point. im just facing one issue. I'm implementing the same code but instead of entering the correct login credentials its just entering username and password as it is taking from the heading of the feature file!! CONFUSED

    • @RaghavPal
      @RaghavPal  2 роки тому

      Hi, check the feature file and test data again,

    • @ss60329
      @ss60329 2 роки тому

      @@RaghavPal Thanks works now

  • @navikasspecials3112
    @navikasspecials3112 3 роки тому

    Hello Raghav, why you used " BY" class instead of webelement?

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Mounika, you can use BY class directly as shown

  • @villagetechstop3920
    @villagetechstop3920 3 роки тому

    Question: Since we already have implicitlyWait timeout then why pageLoadTimeout ??

    • @RaghavPal
      @RaghavPal  3 роки тому

      Hi Sathish, implicitlyWait will work after the page is completely loaded. Mostly having one of these is sufficient but its okay to have both in case required

  • @shreedeevi2800
    @shreedeevi2800 2 роки тому

    Can you make a video on how to create a baseclass in cucumber framework (( like driver initiation and maximize windows etc))))and use in multiple step definitions

    • @RaghavPal
      @RaghavPal  2 роки тому +1

      I will do Shree

    • @shreedeevi2800
      @shreedeevi2800 2 роки тому

      @@RaghavPal please make it as soon as possible sir I'll be waiting
      Thank you🙏

    • @roopaar4726
      @roopaar4726 2 роки тому +1

      @Automation Step by Step Please is there any video on this....You explain very well and useful..please can you share if its there....and also one thing is as i have seen in cucumber for each scenarion....it will login and logout....(before and After hook) can you please make a video where it has 2 scenarios and multiple step definition files and one base class where driver is instantiated and passed to different steps of multiple scenarios

  • @kevingelling9935
    @kevingelling9935 4 роки тому

    Raghav, thanks for the great tutorials so far. I have a question, how to create another test with invalid credentials next to the existing valid login? It seems I can't create this new test because I get a duplicate warning with the same stepdefinitions.

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Hi Kevin, The best way will be to have the invalid credentials in data table and use the same test and you can also provide tags to select with data set to use. I will plan to add a video

  • @nandakamrutha
    @nandakamrutha 5 місяців тому

    Where is hooks class in project structure?

    • @RaghavPal
      @RaghavPal  5 місяців тому +1

      The location of your hooks class in a Selenium Cucumber Java project can vary depending on your project structure and preferences. However, there are some common practices you can follow:
      General locations:
      1. `src/test/java/hooks` package: This is a common convention where you have a dedicated package for all your hooks classes. Each file in this package can represent a specific type of hook (e.g., `BeforeAfterHooks.java`, `ScenarioHooks.java`).
      2. `src/test/java/step_definitions` package: Some projects place hooks alongside step definition classes for convenience. While functional, it can mix concerns if all hooks are within the same package.
      3. Project root: In smaller projects, hooks might be placed directly in the project root directory for quick access. However, this is not recommended for larger or more complex projects due to potential organization issues.
      Tips for choosing the right location:
      * Consider your project size and complexity: For larger projects, a dedicated `hooks` package promotes better organization.
      * Maintain consistency: Follow the existing structure in your project if already defined.
      * Clarity and maintainability: Choose a location that makes sense for your team and keeps your codebase clean and easy to navigate.
      Additional notes:
      * The hooks class itself is just a regular Java class with methods annotated with Cucumber hooks annotations like `@Before`, `@After`, `@BeforeStep`, etc.
      * The method names within the hooks class don't have specific requirements, but choose descriptive names that reflect their purpose (e.g., `setUpDriver`, `tearDownDriver`, `takeScreenshotOnFailedStep`).

  • @mohammadtajuddin7115
    @mohammadtajuddin7115 3 роки тому

    Dont display the words on screen which u r speaking .....It so annoying and covering the imp content shown on screen🙄

    • @RaghavPal
      @RaghavPal  3 роки тому

      Okay, I will take care of this

  • @yasaswinic5169
    @yasaswinic5169 Рік тому

    I am getting null pointer exception i.e java.lang.nullpointerexception cannot invoke org.openqa.selenium.webdrivet.findelement
    Webelement iel = this.driver.findelement(locator);
    This.driver is null
    Pleas help me

    • @RaghavPal
      @RaghavPal  Рік тому +1

      Hi Yasaswini, check the complete code and compare with video, I believe you missed or made some error in declaring driver. Can check my code here - github.com/Raghav-Pal/SeleniumCucumberBDD

  • @sandeshdaju1012
    @sandeshdaju1012 Рік тому

    java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.findElement(org.openqa.selenium.By)" because "this.driver" is null
    at pages.loginPage.enterusername(loginPage.java:26) i got this error. How to solve it

    • @RaghavPal
      @RaghavPal  Рік тому

      Hi Sandesh,
      There are a few possible reasons for this error:
      The WebDriver object is not being instantiated in the code. Make sure that the WebDriver object is being instantiated and that it's being done before the findElement method is called
      The WebDriver object is not being properly passed through the code. Make sure that the WebDriver object is being passed correctly to the class where the findElement method is being called
      The WebDriver object is being instantiated in the wrong scope, for example, the object is being instantiated inside a method, but the findElement method is being called from outside of that method
      The web driver binary is not properly added to the project, please check if the web driver binary is added to the project and it's path is correctly referred in the code
      The compatibility between the version of Selenium, Cucumber and Java is not proper, please check if they are compatible with each other

    • @sandeshdaju1012
      @sandeshdaju1012 Рік тому

      @@RaghavPal Thank you.

  • @archanashanmugavel5335
    @archanashanmugavel5335 Рік тому

    Hi, I followed your video thank you very much !!
    But i'm getting the following error , can you help me to sort it out?
    java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.findElement(org.openqa.selenium.By)" because "this.driver" is null
    at pages.LoginPage.clickonLoginButton(LoginPage.java:26)
    at StepDefinitions.LoginSteps.user_enters_user_name_and_password(LoginSteps.java:42)
    at ✽.User enters UserName and Password(file:///D:/CuCumberAutomation/CucumberJavaNew/src/test/resources/Features/login.feature:5)

    • @RaghavPal
      @RaghavPal  Рік тому

      Hi Archana
      The error message `java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.WebDriver.findElement(org.openqa.selenium.By)" because "this.driver" is null` means that the `driver` variable is null. This can happen if the `WebDriver` object has not been initialized yet.
      To fix this error, you need to initialize the `WebDriver` object before you try to use it. You can do this by creating a new `WebDriver` object in your `@BeforeClass` method.
      Here is an example of how to initialize the `WebDriver` object in your `@BeforeClass` method:
      ```
      @BeforeClass
      public static void setUp() {
      System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
      driver = new ChromeDriver();
      }
      ```
      Once you have initialized the `WebDriver` object, you can use it in your `@Test` methods.
      Here is an example of how to use the `WebDriver` object in your `@Test` method:
      ```
      @Test
      public void testLogin() {
      driver.get("www.example.com");
      LoginPage loginPage = new LoginPage(driver);
      loginPage.enterUserName("username");
      loginPage.enterPassword("password");
      loginPage.clickLoginButton();
      }
      ```
      If you are still getting this error after you have initialized the `WebDriver` object, then there may be another problem with your code. You can try to debug your code to find the problem.