Selenium Python Small Sample Project | Page Object Model POM

Поділитися
Вставка
  • Опубліковано 1 жов 2024

КОМЕНТАРІ • 667

  • @RaghavPal
    @RaghavPal  5 років тому +12

    Online courses - automationstepbystep.com/

    • @prasadsardesai
      @prasadsardesai 5 років тому

      I tried this code in eclipse , didn't work--->
      '''
      Created on 07-Jan-2019
      @author: Prasad
      '''
      from selenium import webdriver
      import unittest
      class Logintest(unittest.TestCase):

      @classmethod
      def setup (cls):
      cls.driver = webdriver.Chrome(executable_path="C:/GoogleChromeDriver/chromedriver.exe")
      cls.driver.implicitly_wait(10)
      cls.driver.maximize_window()

      def test_login_valid(self):
      #self.driver = webdriver.Chrome(executable_path="C:/GoogleChromeDriver/chromedriver.exe")
      self.driver.get("phptravels.org/clientarea.php")
      self.user_name=self.driver.find_element_by_name("username")
      self.user_name.send_keys("Dont want to share here")
      self.password=self.driver.find_element_by_name("password")
      self.password.send_keys("Dont want to share here")
      self.password=self.driver.find_element_by_name("password")
      self.driver.find_element_by_id("login").click()

      @classmethod
      def tear_down(cls):
      cls.driver.close()
      cls.driver.quit()
      print("Test completed..")

      # def login (self,username,password):


      ----------> Getting below error :
      FFinding files... done.
      Importing test modules ... done.
      ======================================================================
      ERROR: test_login_valid (Login.Logintest)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
      File "D:/SeleniumProject/Python_Selenium/CRM_Application/com_actionables\Login.py", line 21, in test_login_valid
      self.driver.get("phptravels.org/clientarea.php")
      AttributeError: 'Logintest' object has no attribute 'driver'
      ----------------------------------------------------------------------
      Ran 1 test in 0.004s
      FAILED (errors=1)

    • @prasadsardesai
      @prasadsardesai 5 років тому

      but still I am enjoying it

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Prasad, looks like you missed some step. Request you to refer the video again carefully

    • @MsAaadil
      @MsAaadil 5 років тому +1

      where are the notes ?

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

      @@prasadsardesai Facing the same issue "AttributeError: type object "LoginTest' has no attribute 'driver'". have you got the solution for this ?

  • @neighbourhoodcoder5988
    @neighbourhoodcoder5988 4 роки тому +14

    this tutorial should get more recognition.....clearly explained. keep up the good work man,Cheers!!

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

      So happy to read your message Ahmed

  • @mmcooe
    @mmcooe 5 років тому +5

    One point to note here is that unit tests in python recognize test cases only if prefixed with test_. Example: test_login_valid. If you don't prefix test then no error is thrown but tests run as Run 0 test in 0.00s

    • @tuannguyen-on1up
      @tuannguyen-on1up 5 років тому +1

      correct. you're right. And that is why he used to prefix test

  • @ChatGPTtest-tp3vi
    @ChatGPTtest-tp3vi 3 місяці тому +1

    Hello Raghav Da, Thanks for this amazing tutorial. I could follow most of it without any problem but facing a bit of issue when calling the loginpage class in my logintest. So when ever I am creating an object of that class it is throwing error because of the parameters called. Its says the parameter is unrecognized. When looking for the suggestions I am getting the parameter as "driver=".
    I am not sure what should be the value of the driver, what should I put after equals sign.. when calling it in the test class, can you please help?
    Thank you so much.
    Binita

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

      Binita
      When working with the Page Object Model (POM) in Selenium Python, you need to pass the WebDriver instance (the browser driver) to your page classes. Let’s address this issue:
      1. Passing WebDriver to Page Classes:
      - In POM, each page class should have a `WebDriver` object as a class member. This allows you to interact with web elements on that page.
      - You can pass the `WebDriver` instance as a parameter to the constructor of your page class.
      2. Example Implementation:
      - Suppose you have a `LoginPage` class. Here's how you can pass the `driver` to it:
      ```python
      from selenium import webdriver
      class LoginPage:
      def __init__(self, driver):
      self.driver = driver
      # Other page elements and methods go here
      # Usage in your test class:
      driver = webdriver.Chrome() # Initialize your WebDriver (e.g., Chrome, Firefox, etc.)
      login_page = LoginPage(driver) # Create an instance of LoginPage
      ```
      3. Page Factory (Optional):
      - If you're using Page Factory (a part of POM), you can simplify this further:
      ```python
      from selenium.webdriver.common.by import By
      from selenium.webdriver.support.ui import WebDriverWait
      from selenium.webdriver.support import expected_conditions as EC
      class LoginPage:
      def __init__(self, driver):
      self.driver = driver
      # Initialize page elements using @FindBy annotations
      # Usage in your test class:
      driver = webdriver.Chrome()
      login_page = LoginPage(driver)
      ```
      Remember to adjust the class name (`LoginPage` in this example) to match your actual page class
      --

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

    This is exactly what I needed, thank you very much for such a clear explanation!

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

      Most welcome Jose Luis

  • @Jele-f2c
    @Jele-f2c 2 місяці тому +1

    Hi there, I had a question. In what scenarios will running the tests from command line be helpful ? Doing that seems like more work when we can just run it from the IDE 😅

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

      Jele
      Let's break down the scenarios where running Selenium tests from the command line can be helpful:
      I am added all details. it can be long but i hope will help everyone in future...
      Scenario 1: Automation and CI/CD Pipelines
      When you're working on a large project, you might want to automate the testing process as part of your Continuous Integration and Continuous Deployment (CI/CD) pipeline. Running tests from the command line allows you to integrate your tests with tools like Jenkins, Travis CI, CircleCI, or GitHub Actions. This way, your tests can run automatically whenever code changes are pushed to your repository, ensuring that your code is tested thoroughly before deployment.
      Scenario 2: Multi-Environment Testing
      Imagine you need to test your application on different environments, such as different browsers, operating systems, or mobile devices. Running tests from the command line allows you to easily switch between environments by modifying the command-line arguments or environment variables. This can be more efficient than constantly changing settings within your IDE.
      Scenario 3: Distributed Testing
      When you have a large test suite, running tests in parallel can significantly reduce the overall testing time. Command-line execution enables you to distribute your tests across multiple machines or containers, making it easier to scale your testing efforts.
      Scenario 4: Headless Testing
      Sometimes, you might want to run your tests in a headless mode, without displaying the browser UI. Command-line execution makes it easy to run tests in headless mode, which can be useful for testing in environments where a display is not available or when you want to reduce the resource usage.
      Scenario 5: Scheduled Testing
      You might want to schedule your tests to run at specific times or intervals, such as nightly or weekly. Command-line execution allows you to use tools like cron jobs (on Linux/macOS) or Task Scheduler (on Windows) to automate the testing process.
      Scenario 6: Remote Testing
      When working in a team, you might want to run tests on a remote machine or a cloud-based infrastructure. Command-line execution enables you to run tests remotely, making it easier to collaborate with team members or use cloud-based testing services.
      Scenario 7: Debugging and Troubleshooting
      When debugging issues, running tests from the command line can provide more detailed output and error messages, making it easier to identify and troubleshoot problems.
      While it's true that running tests from the IDE can be more convenient, there are scenarios where running tests from the command line provides more flexibility, scalability, and automation capabilities
      -

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

    How can I solve this error?
    TypeError: LoginPage () takes no arguments
    at login = LoginPage (driver)

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

      Hi Tavo, pls check your LoginPage class and its constructor. Most probably, you have not taken any arguments in the constructor

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

    Hi Raghav, I see that you have used HtmlTestRunnerfor generating the reports but this does not seem to work with python 3.0+ is there any other alternative?

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

      Hi Vishal, can check the ver that works with Python3, pypi.org/project/HTMLTestRunner-Python3/

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

    I have one general question regarding writing test cases. Suppose if we are testing a form and if it has 2 inputs (login and password) then should we write all the test cases for it?
    1) Valid Login name, Valid Password
    2) Valid login name, Invalid Password
    3) Invalid Login name, Valid Password
    4) Invalid Login name, Invalid Password

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

      Hi Nandish, yes you can cover all possible scenarios. A data driven test will be better here where you can get the data drom a external file like excel

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

      @@RaghavPal thanks. But suppose if there are 16 input items in the form then i think there will be thousands of test cases if we follow the same approach.. So how to write test cases in that scenario?

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

      Sorry for late reply Nandish, I believe the test is same and the data varies, In that case data-driven test OR getting data from an external file is the best option.

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

    how to open the orangehrm site with english text, it is opening for me in chines language?

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

      Hi Srinivasa, its from the backend, you can use these to practice
      opensource-demo.orangehrmlive.com/
      trytestingthis.netlify.app/

  • @fraven9586
    @fraven9586 2 роки тому +2

    I really liked the quality and patience with which he teaches. Please, if you could continue with more advanced cases. Greetings from Peru!

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

      Hi Fraven, sure I will

  • @dineshkhanna963
    @dineshkhanna963 5 років тому +3

    Excellent video. Neat & Clear. You are good in teaching. Best video to learn Page Object Model for Python Selenium

    • @RaghavPal
      @RaghavPal  5 років тому

      Glad & humbled to know this Dinesh

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

    Hello, Raghav!
    This video is very useful for me.
    I'm a newbie in Selenium, and here are my questions:
    1) 50:59 - We should write "message = driver.find_element_by_xpath("//span[@id='spanMessage']").text" instead of "message = driver.find_element_by_xpath("").text". Am I right?
    2) 50:31 - We don't call the function "check_invalid_username_message" anywhere. Is it ok? When should it be called?

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

      1) Yes right
      2) You can call it wherever you need in your test. In case you do not need do not call

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

    Hi , I see a lot of people have blocked on unresloved error problem for import: ImportError: No module named SampleProjectPOM.POMDemo.Pages.LoginPage
    but it seems that there is no solution posted yet :(
    could some one help ? (for info, even when marked the floder as sources ROOT it doesn't work)
    thank you in advance :)

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

      Hi Saber, I have shown the solution in this video from ua-cam.com/video/BURK7wMcCwU/v-deo.html. Please check.
      Start your command with python -m pytest
      Please check this:stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayadagithub.com/pytest-dev/pytest/issues/2287

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

    Hi Raghav, Thank you so much for the tutorial.But when I try to import HTMltest runner in pycharm which is already installed via cmd, shows not installed and when I try to install the package in Pycharm, getting following error.
    Collecting HtmlTestRunner
    Could not find a version that satisfies the requirement HtmlTestRunner (from versions: )
    No matching distribution found for HtmlTestRunner
    Please help.

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

      Hi Shilpa, can you check the documentation for HTML runner and see the supported python versions.

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

    Hi Raghav,
    Thanks to put this selenium framework using POM| Unit test| HTML reports. It was really helpful video for a beginner like me who are keen to learn about developing a sustainable framework.
    This video is really well structured and organized that can help anyone who does not have any prior knowledge in framework development.
    Coming to my query, I have imported HtmlTestRunner module and even added the report path in unittest.main().
    But, when i am trying to run the script in cmd, it shows the following error :
    Traceback (most recent call last):
    File "C:\Python38-32\lib
    unpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
    File "C:\Python38-32\lib
    unpy.py", line 111, in _get_module_details
    __import__(pkg_name)
    File "C:\Users\Anjali\PycharmProjects\Selenium-Framework\DemoProject\POMProjectDemo\Tests\login.py", line 5, in
    import HtmlTestRunner
    ModuleNotFoundError: No module named 'HtmlTestRunner'
    Can, You tell me where i am making mistake.
    Thank you in advance : )

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

      Hi Anjali, so happy to know this. Keep learning and also help others

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

    Solution for error message on running the invalid test on 53:00 :
    Needed to give parameters as so :
    message = driver.find_element_by_xpath(login.invalidUserName_msg_xpath).text
    instead of :
    message = driver.find_element_by_xpath("").text
    In the login.py file :P

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

    Getting issue in HtmlTestRunner PFB error
    I tried upgrading my python to latest version after this error still didn't solve for me could any one please help.
    "Could not find a version that satisfies the requirement HtmltestRunner (from versions: none)"

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

      Hi Bhupendra, could not find any specific solution online. In the documentation page - pypi.org/project/html-testRunner/ it says can work with Python 3.5

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

    Hello sir, Could you please make a video on selecting dependant drop down values in an array which is for example if you select one drop down value then another drop down should appear in the UI so that I can select the next drop down value. Currently I am facing problem in automating this in python

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

      Hi Prabhu, I will plan to have a session on this, In case you have some demo website, can send me the link

  • @sayari_sachanji
    @sayari_sachanji 6 років тому +3

    nice 1, waiting for the video of reading test input like username, password from the CSV file.

    • @RaghavPal
      @RaghavPal  6 років тому +1

      will do i† soon

    • @sayari_sachanji
      @sayari_sachanji 6 років тому

      Automation Step by Step - Raghav Pal thank you so much :)

  • @amareshawati1563
    @amareshawati1563 5 років тому +1

    Hi Raghav, Thank you very much for your tutorial. I want to capture screenshot when the test case fails and i want to add same screenshot to the html report. Is this possible in selenium-python? if yes, please help me how can I do that.

    • @amareshawati1563
      @amareshawati1563 5 років тому

      Hi Raghav, Any luck on this?

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Amaresh, you can use PyTest. This will help - www.automationtesting.co.in/2017/02/pytest-with-selenium-html-report-with.html?m4dc=1
      stackoverflow.com/questions/50534623/how-do-i-include-screenshot-in-python-pytest-html-report

  • @kamalnathlp6814
    @kamalnathlp6814 5 років тому +1

    Have Enjoyed your session and learned lot sir. There is small mistake in xpath that you didn't call the function "check_invalid_username_message ".

    • @RaghavPal
      @RaghavPal  5 років тому

      I will check Kamalnath. Thanks for watching

  • @ahmed199027
    @ahmed199027 6 років тому +2

    Thanks a lot bro, Your videos are always Excellent. Please make videos on Serverless AWS.

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

    Can i get full paylist link?

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

      Sure, pls check here - automationstepbystep.com/

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

    Raghav, can you please make a video on how to explain our framework with respect to OOPS concepts.

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

      Sure Akshat, you may find some tutorials on programming and OOPs here - automationstepbystep.com/

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

    Hi Sir,
    For following code I am getting error as : 'Config' object has no attribute '_metadata'
    def pytest_configure(config):
    config._metadata['Project Name'] = 'Vyrill'
    config._metadata['Module Name'] = 'Admin Dashboard'
    config._metadata['Tester'] = 'Rahul'
    Could you please give me a solution on this? I am using
    python: 3.6.8
    pytest: 4.6.11
    Thanks!

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

      Hi, can check this github.com/conda/conda-build/issues/3093

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

    Hi Raghav, i tried to generate html report, but after running on mac os, this report can't generate?
    testRunner=HtmlTestRunner.HTMLTestRunner(output='/Users/fawzi/PycharmProjects/pythonProject1/reports', report_name="Login Report", report_title="Login Report", add_timestamp=True))
    this is correct?

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

      Hi Fawzi, will need to see the logs and error report, meanwhile compare your syntax and path

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

    im getting below error
    File "C:\Users\arumugam001\PycharmProjects\SeleniumDemo\RW\Test\login.py", line 21, in test_login
    driver = self.driver
    AttributeError: 'LoginTest' object has no attribute 'driver'

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

      Hi Siva, pls check again, you may be missing some import

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

    Hi Raghav,
    Facing below error :-
    ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
    ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

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

      Hi Nitesh, There can be multiple reason behind this error:
      Presence of anti-virus softwares.
      Firewall blocking the ports.
      Network Configuration.
      Problem can be caused by CORS.
      Due to enabling of HTTP keep-alive connections
      this can help - stackoverflow.com/questions/51562067/connectionabortederror-winerror-10053-an-established-connection-was-aborted-b

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

    Raghav, i'm geting an error msg while executing the tests with Pytest: FAILED Test_duck.py::TestDuck::test_search - AttributeError: 'TestDuck' object has no attribute 'driver'
    what's the problem with the driver? Thx

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

      Hi Federico, some issue where you created driver instance, can check this sqa.stackexchange.com/questions/46901/attributeerror-testone-object-has-no-attribute-driver

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

    Hello Raghav, thank you for this video, it's the best I've come across on the topic. I've followed your video and keep getting the "ModuleNotFoundError" when I try and run the tests :(
    I have the tests and page objects in different folders and import the page objects class into the tests, I've also looked online for a solution, tried all I could. Still getting that error.
    Could you advise please?
    Many thanks!

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

      Hi, I have shown the solution in this video from ua-cam.com/video/BURK7wMcCwU/v-deo.html.

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

    from POMProjectDemo.Pages.loginPage import LoginPage
    ModuleNotFoundError: No module named 'POMProjectDemo' in vs code kindly why we get plz provide solution 35:39

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

      Hi Ram,
      I have shown the solution in this video from ua-cam.com/video/BURK7wMcCwU/v-deo.html.
      Please check. stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
      on command line go one folder up from the folder from where you have any imports in your script
      For example this is your project structure: ProjectFolder/Example/Demo/file.py In you file.py you have your code with import statements.
      Suppose one of the import is from Demo folder So on command line goto folder Example (parent of demo folder) and then say command python -m unittest Demo.file . (note do not give .py extension)

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

    Hi sir, I had import error on implement POM Please give me a solution.
    SampleProject.POMProjectDemo.Page.loginPage import LoginPage
    ImportError: No module named SampleProject.POMProjectDemo.Page.loginPage

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

      Hi Pooja, I have shown the solution in this video from ua-cam.com/video/BURK7wMcCwU/v-deo.html. Please check.
      stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
      on command line go one folder up from the folder from where you have any imports in your script
      For example this is your project structure:
      ProjectFolder/Example/Demo/file.py
      In you file.py you have your code with import statements.
      Suppose one of the import is from Demo folder
      So on command line goto folder Example (parent of demo folder)
      and then say command
      python -m unittest Demo.file .
      (note do not give .py extension)

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

    Hi Raghav,
    I was able to debug this error. I ran my test script via pycharm terminal and it successfully ran and generated HTML report.
    But i still wants to know why it was throwing error when i tried to run from cmd.
    Please, give your valuable input and resolve my query. : )

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

      Hi Anjali, is this referred to some previous comment. You can reply on the same comment thread, so I can get the context.

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

    Hi Raghav , thanks for sharing . In my opinion I would prefer : visibility_of_element_located rather than presence_of_element_located coz I first wait for the visibility of the object and then yes I interact with that element.

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

      ok, sure can go with what is best for your needs and project requirements El

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

    Hi Raghav 👋 .I am trying to apply the page object pattern. My problem is that I do not get an autosuggestion when typing self.driver. After the . I should see suggestions, but I am not; however if I were to run the program it run without any problem. Any solution

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

      Hi, you can try to restart Pycharm and check again

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

    i can somehow call out method from another file but the code isn't running saying that it doesn't find the module despite the fact that I've changed directory of module package either by import sys ... edit enviroment in windowds or run launch.json and settings.json. I'm kinda hopeless at this point. I rly want to finish this project but i cannot go past this problem in VS code.

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

      Hi Łukasz, pls check this github.com/microsoft/vscode/issues/10391

  • @feiomaskatista
    @feiomaskatista 5 років тому +1

    What if I create like in Java a "base_class.py" with the selenium driver instance and the set up methods in it? I got this question because the way you're teaching, we will need to code in every test class driver = webdriver... driver.implicity.... and I have learned that when we are repeating code, there is something not planned. What is your point?

    • @RaghavPal
      @RaghavPal  5 років тому +1

      Hi Danilo, yes you can create a base class where web driver is instantiated, i will cover this in some future video.

    • @feiomaskatista
      @feiomaskatista 5 років тому +1

      @@RaghavPal Cool! Great videos by the way!!!

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

    Hi Ragav. I have 1 queries. Curently I am using pyautogui for screenshot. It's taking screenshot for the browser window where the script is running. But while execution if I minimise the browser window and open any other application then execution still run but it capture the other app window as screenshot
    Can you suggest how I can take the screenshot even if I minimise the browser. I mean if execution run in background in that case how to take that screenshot

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

      Hi Neelambika, you may try some other libraries for screenshots. Check this
      pythonbasics.org/selenium-screenshot/
      www.geeksforgeeks.org/how-to-take-screenshot-using-selenium-in-python/
      stackoverflow.com/questions/41721734/take-screenshot-of-full-page-with-selenium-python-with-chromedriver

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

    I have a small question. Around @11:39 in the video you have used find by link text. Now if I have multiple links of same text (like a click here text but at multiple places in a same page table), but dont have any identifier like id or class is there anyway to access one particular link?

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

      Hi Loga, in that case you can use index value

  • @fxboss6255
    @fxboss6255 13 днів тому

    thank you for amazing video! is there an equivalent of pom.xml in java for python?

    • @RaghavPal
      @RaghavPal  13 днів тому

      In Python, there isn't a direct equivalent to pom.xml. However, alternatives like requirements.txt, setup.py, and pyproject.toml serve similar purposes. These files specify dependencies, metadata, and build settings for Python projects

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

    Hi Raghav,
    I have one doubt-if i am running my test script from command line reports are generating but if i am trying to run from Pycharm i m not getting the reports (not generating)..
    You can find my code @ github.com/anand032111/google_selenium/blob/master/UnitTest.py
    Please help me in this

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

      Hi Anand for the specific way shown, this generates from command line pytest command only. You can find other ways and libraries for report generation

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

    Hello, Awesome video I'm using Pycharm, and I did "pip install Selenium" and I have Anaconda Python - trying to automate Testcases using these tools, getting a 'Unresolved reference' error when I import Selenium webdriver. Am I missing any step here...pls could you give your input. Thanks

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

      Hi Ambika, You can check the library is added in the project or interpreter.
      PyCharm (File in windows) -> Preferences (Settings on Windows) -> Project -> Project InterpreterHere you can see list of libaries
      You can also click on '+' sign to add new library (python module)

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

      @@RaghavPal I tried the above steps getting a SSL certificate error....Thanks

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

      Hi Ambika, pls try to see some online solutions for this

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

    Great tutorial. Completely understood. The only thing is that ,for me in loginpage, homepage class if i do self.driver. ,then no option for find elements was showing, i have done it manually and its working fine. This is strange.

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

      Hi Tapas, you might have imported the class with all properties

  • @ArturSpirin
    @ArturSpirin 5 років тому

    Every video I have watched teaches POM in a half baked manner. Its like info here is not wrong but its incomplete and thus steers people the wrong way because once they learn this - its hard to unlearn and do it right (that's assuming they even will continue try to improve their skills in page objects, most will just assume this is the only way).

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Artur, you can provide more details. It will help all

  • @PardeepKumarbindass
    @PardeepKumarbindass 5 років тому +1

    Excellent Tutorial Raghav, Could you please tell me why we use constructor here?

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Pradeep, constructor is called whenever we create a object of the class. We make use of this property to force user to provide some parameters while creating objects

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

    Amazing quality, eventhough is old version of selenium if you know how to set up new on this will give you a complete Idea how to work with each topic, If you a have some projects we can practice this topic please let me know.

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

      Sure, will check on that

  • @s2613
    @s2613 5 років тому +1

    Could please suggest me Build tools for Python selenium
    And for Ci tool

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Keisha, for build tool you can use PyBuilder - pybuilder.github.io/
      Also check this - packaging.python.org/guides/tool-recommendations/
      For CI Jenkins is good

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

    I exactly followed this for my project but while login test am getting attribute error, it is not allowing me to have a 'driver' as an attribute. Can someone help me.

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

      Hi Ajith, looks like some setup or syntax issue, check the code again with the example, can try some online examples as well

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

    hi Raghav
    had a query , can we able to add all locators in a different file under the project and able to import to the current file?
    rather than giving locators straight away as pointed in the above video?

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

      Hi, yes, that's how we do Page Object Model, you may find it in some of my videos automationstepbystep.com/

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

    I haven't seen that much crystal clear concept explanation... l'm fascinated by your teaching style and content provided by you... Thanks alott Sir👍

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

      You're very welcome Sandip

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

    Very nice video. what is the use of unittest here if I don't use unittest can't I use selenium with classes? in production unittest should be used ? please clarify my doubts thank you.

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

      Hi, you can use any testing framework as per your needs

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

    One problem i see here that we are not getting auto suggestions for the driver object for its method in POM structure any solution or reason for this? if the project is big where we need to write lot of wrappers and different selenium methods its very difficult to manage without auto suggest

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

      Hi Pritesh, just check all lib are added and try to restart pycharm.

  • @Manishkansara-dq5tj
    @Manishkansara-dq5tj 5 місяців тому

    Thank you so much for doing fantastic job, I am watching your all automation related videos and learned a lot.

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

      So happy and humbled to know this Manish.. keep learning

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

    Thanks for your video! i am already watching this video 10 times!! this is very useful video!

  • @komalshah2979
    @komalshah2979 5 років тому

    Hello Raghav ....i have implement this code in pycharm but it didn't work it and the url is not open in browser also can you please help me

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Komal, will need to see error details and logs to troubleshoot

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

    Hi Mr Raghav, in my HTML report i see unwanted values displayed along with result status. How to remove those?
    something like these
    (function() { var ws = new WebSocket('ws://' + window.location.host + '/jb-server-page?reloadMode=RELOAD_ON_SAVE&'+ 'referrer=' + encodeURIComponent(window.location.pathname)); ws.onmessage = function (msg) { if (msg.data === 'reload') { window.location.reload(); } if (msg.data.startsWith('update-css ')) { var messageId = msg.data.substring(11); var links = document.getElementsByTagName('link'); for (var i = 0; i < links.length; i++) { var link = links[i]; if (link.rel !== 'stylesheet') continue; var clonedLink = link.cloneNode(true); var newHref = link.href.replace(/(&|\?)jbUpdateLinksId=\d+/, "$1jbUpdateLinksId=" + messageId); if (newHref !== link.href) { clonedLink.href = newHref; } else { var indexOfQuest = newHref.indexOf('?'); if (indexOfQuest >= 0) { // to support ?foo#hash clonedLink.href = newHref.substring(0, indexOfQuest + 1) + 'jbUpdateLinksId=' + messageId + '&' + newHref.substring(indexOfQuest + 1); } else { clonedLink.href += '?' + 'jbUpdateLinksId=' + messageId; } } link.replaceWith(clonedLink); } } }; })();

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

      Will need to check the setup Sudharshan, Can also try using a diff version

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

    This video is very very helpful for me I learned from here about POM and how to define class in main file , Thank you

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

      Great to know this. All the best

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

    TypeError: LoginPage() takes no arguments
    all code is ok but sitll eror
    plz guide me

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

      Hi Agha, will need to check the setup and details

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

    Excellent. Kudos For your Hardwork Man...

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

    Awesome! Thanks a lot for this very interesting and clear course. I've recommended collegues and friends to watch these videos.

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

      Awesome, thank you! Find more here - automationstepbystep.com/

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

    Hi Ragav,
    I follow up on this sample project creation, but I'm getting an error. please help me to resolve this
    I changed the edit configuration to run as unit test after a run through the unit test, I'm unable to execute the code
    Launching unittests with arguments python -m unittest C:/Users/PremataS/PycharmProjects/pythonProject/Sample_Project/POM_Demo/Tests/Create_Account.py in
    C:\Users\PremataS\PycharmProjects\pythonProject\Sample_Project\POM_Demo\Tests
    Ran 0 tests in 0.000s
    OK
    Process finished with exit code 0
    Empty suite
    Empty suite

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

      Hi Shehani, while using pytest, pls check your file, class and function names.
      File name - test_*.py or *_test.py
      Class name - prefixed with Test
      Function name - prefixed with test
      Can do the setup again and check

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

      @@RaghavPal Thanks for the instruction Ragav. It is working fine now.

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

    there is no function self.browser.find_element_by_id in Python 4 and there's self.browser.find_element(By.ID, "btnLogin") instead. How should I change self.browser.find_element_by_id(self.username_textbox_id)?

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

      HI Lilia, I will check for Python 4 and add new sessions, For now, if you need to use Python 4, check the latest Selenium Python 4 documentation
      www.selenium.dev/documentation/webdriver/getting_started/upgrade_to_selenium_4/

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

      @@RaghavPal thank you so much. Do you have GitHub with all the lesson’s codes by any chance?

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

      Can check there Lilia - automationstepbystep.com/

  • @arunaszygis2912
    @arunaszygis2912 5 років тому

    After using the command in Windows 10 CMD(Command Prompt) C:\Users\my.name\PycharmProjects\PROJECTNAME\Tests>python -m unittest login.py
    I got an error:
    ImportError: Failed to import test module: login
    Traceback (most recent call last):
    File "C:\Users\my.name\AppData\Local\Programs\Python\Python37-32\lib\unittest\loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
    File "C:\Users\my.name\PycharmProjects\PROJECTNAME\Tests\login.py", line 4, in
    from Pages.loginPage import LoginPage
    ModuleNotFoundError: No module named 'Pages'
    How to solve that?

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Arunas,
      I have shown the solution in this video from ua-cam.com/video/BURK7wMcCwU/v-deo.html. Please check.
      stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
      On command line go one folder up from the folder from where you have any imports in your script
      For example this is your project structure:
      ProjectFolder/Example/Demo/file.py
      In you file.py you have your code with import statements.
      Suppose one of the import is from Demo folder
      So on command line goto folder Example (parent of demo folder)
      and then say command
      python -m unittest Demo.file .
      (note do not give .py extension)

    • @mrherisusilo
      @mrherisusilo 5 років тому +1

      @@RaghavPal Oh My God! God bless You. Thank you!

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

    Could you please explain how to integrate build management tool like maven with python selenium?

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

      I will plan on this Rishav

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

    what if the classes have same name when web scrapping using selenium python. kindly reply.

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

      Hi Ashwini, not sure on scrapping, will have to take online help

  • @hkapadia6191
    @hkapadia6191 5 років тому

    When I try to run POM project on Windows 10 using Google Chrome v76.0 (64-bit). I am getting error below message:
    selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73
    (Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 10.0.18362 x86_64)
    Is anyone run into this issue before?
    So to continue with this lesson I have decided to use Firefox v69.0 (64-bit) and the same project is running fine.

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi, this is issue with chrome ver. Try to use a diff ver of chromedriver.exe

    • @hkapadia6191
      @hkapadia6191 5 років тому +1

      @@RaghavPal Thanks Raghav.

  • @hkapadia6191
    @hkapadia6191 5 років тому

    When I try to run LoginTest using Firefox v69.0 (64-bit) using 'import HtmlTestRunner'. I am getting following error message:
    ImportError: Failed to import test module: login
    import HtmlTestRunner
    ModuleNotFoundError: No module named 'HtmlTestRunner'
    I have also verified thru command prompt that my machine contains html-testRunner v1.2.1, selenium v3.141.0, py v1.8.0, pip v19.2.3.
    Can someone please help me to resolve this issue?

    • @RaghavPal
      @RaghavPal  5 років тому +1

      Hi, Check the required libraries are imported in the project
      PyCharm (File in windows) -> Preferences (Settings on Windows) -> Project -> Project InterpreterHere you can see list of libaries
      You can also click on '+' sign to add new library (python module)

    • @hkapadia6191
      @hkapadia6191 5 років тому +1

      @@RaghavPal Thank you Raghav for your reply. After inserting html-testRunner package to PyCharm I am now able to run my script. Thanks again for your help.

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

    Hi Raghav,
    I was facing issues in understanding the concept of POM in selenium Python, your tutorial above has cleared all my doubts and implementation of POM in selenium Python Raghav, thx a ton for helping us out with such useful videos on testing stack, Raghav, the above POM what ever has been explained in the video is without using Page Factory ryt?? correct me if i'm wrong.. Can u kindly explain the same above example and concept by also using page factory and POM as well in selenium python.. It would be really useful for us ...
    Thanks in Advance,
    Siddhee :)

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

      Happy to know this Siddhee, will do a session on Page Factory too

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

      @@RaghavPal Thanks a ton Raghav :), will be waiting for your tutorial on Page factory model in selenium python, kindly do let me wen u upload it.. and also i have to admit whenever ppl have doubts/questions u always took that extra initiative in replying to each and everyone whoever has doubts and commented..that virtual help is much needed and thanx a ton again Raghavv :)
      Thanks in Advance,
      Siddhee :)

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

    Hello sir, i want to implement POM with pytest. is there any video available?

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

      I may not have specific video, but you can follow this and add pytest..but these steps will help you:
      1. Set Up Your Environment:
      - Install Python: Make sure you have Python installed on your system. You can download it from the official Python website.
      - Install PyCharm (or any other preferred IDE): PyCharm is a popular IDE for Python development.
      2. Create a New Python Project:
      - Open PyCharm and create a new Python project.
      - Set up a virtual environment for your project.
      3. Install Required Packages:
      - Install the necessary packages using pip:
      ```
      pip install selenium pytest
      ```
      4. Create Page Classes:
      - Create a package (folder) named `pages` within your project.
      - Inside the `pages` package, create a Python file for each webpage you want to automate. These files will serve as your Page Classes.
      - In each Page Class, define the web elements (locators) and methods to interact with those elements. For example:
      ```python
      # Example Page Class for a login page
      class LoginPage:
      def __init__(self, driver):
      self.driver = driver
      self.username_input = "username_locator"
      self.password_input = "password_locator"
      self.login_button = "login_button_locator"
      def enter_credentials(self, username, password):
      self.driver.find_element_by_id(self.username_input).send_keys(username)
      self.driver.find_element_by_id(self.password_input).send_keys(password)
      def click_login_button(self):
      self.driver.find_element_by_id(self.login_button).click()
      ```
      5. Write Test Cases:
      - Create a package (folder) named `tests` within your project.
      - Inside the `tests` package, create Python files for your test cases.
      - In each test case, instantiate the Page Classes and use their methods to perform actions on the webpages.
      6. Write PyTest Test Functions:
      - In your test files, write PyTest test functions.
      - Use the `@pytest.fixture` decorator to set up and tear down the WebDriver instance.
      - Example:
      ```python
      import pytest
      from selenium import webdriver
      from pages.login_page import LoginPage
      @pytest.fixture
      def setup():
      driver = webdriver.Chrome(executable_path="path/to/chromedriver")
      yield driver
      driver.quit()
      def test_login(setup):
      driver = setup
      login_page = LoginPage(driver)
      login_page.enter_credentials("your_username", "your_password")
      login_page.click_login_button()
      # Add assertions to verify successful login
      ```
      7. Run Your Tests:
      - Open the terminal in PyCharm and run your tests using the following command:
      ```
      pytest
      ```
      8. Review Reports:
      - PyTest generates HTML reports with test results. You can find them in the `reports` folder (create this folder if it doesn't exist).
      Remember to replace the example locators and test data with your actual application's details.

  • @Canda-fh4xc
    @Canda-fh4xc 5 років тому +2

    Thank you for this great tutorial. Do you have any tutorial about Appium?

    • @RaghavPal
      @RaghavPal  5 років тому +2

      Hi Sam, thanks for watching Appium will be coming soon

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

    This video is very Helpfull, I tried the same using Locater model and successfully wrote a Page object model for entering the data into a website, But I am facing some difficulties in Web scraping syntax. Could you please help me with the syntax
    I am using this
    def getPrice(self):
    return self.driver.find_element_by_xpath(loc.Price).text
    Please help me with this!

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

      Hi Gowtham, I will have to check and prepare for this. Will try but can take some time

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

      @@RaghavPal Thank you so much for the timely reply, I just figured out the Syntax,
      def getPrice(self):
      return self.driver.find_element_by_xpath(loc.Price).text
      we have to call this in the script as
      page.getPrice()

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

    Hi! Login page gives message "invalid credentials". Can you fix it?

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

      Can try a different app

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

    can you help with data provider - how to run with different data parameters in python selenium

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

      I will plan for a session Akash

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

    Hi, Raghav. I am stuck at "Selenium Python Small Sample Project | Page Object Model POM" at 43:05. My Command Prompt still saying "No module named 'SampleProjects''". I have tried all of the options and none of them worked. Please, help. Thank you.

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

      Hi Muslima,
      I have shown the solution in this video from ua-cam.com/video/BURK7wMcCwU/v-deo.html.
      Please check. stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
      on command line go one folder up from the folder from where you have any imports in your script
      For example this is your project structure: ProjectFolder/Example/Demo/file.py In you file.py you have your code with import statements.
      Suppose one of the import is from Demo folder So on command line goto folder Example (parent of demo folder) and then say command python -m unittest Demo.file . (note do not give .py extension)

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

      @@RaghavPal Thank you so much.

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

    Do you have an example of how get the size of Table and dynamically create a path.

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

      Hi Jeffrey, not as of now

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

    Hello, Raghav. Thank you for a great tutorial. I have a problem with importing class. //from Selenium.POMProjectDemo.Pages.LoginPage import loginPage -- gives me an error that No module named 'Selenium'.

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

      Hi Namik, I have shown the solution in this video from ua-cam.com/video/BURK7wMcCwU/v-deo.html.
      Please check. stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
      on command line go one folder up from the folder from where you have any imports in your script
      For example this is your project structure: ProjectFolder/Example/Demo/file.py In you file.py you have your code with import statements.
      Suppose one of the import is from Demo folder So on command line goto folder Example (parent of demo folder) and then say command python -m unittest Demo.file . (note do not give .py extension)

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

      @@RaghavPal Thank you very much, I find the solution from your video description)). import sys
      import os
      sys.path.append(os.path.join(os.path.dirname(__file__), "D:\python\Selenium\POMProjectDemo\Tests", "D:\python\Selenium\POMProjectDemo\Pages"))
      It is working.

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

    is tab spacing not required as we discussed in one of the previous sessions?
    can you please clarify

  • @mohammadjaved9620
    @mohammadjaved9620 5 років тому +1

    Thanks Raghav, it is really awesome lesson. I can get "find_element_by_??" in the loginPage.py. How to access "find_elements_by_??" methods in loginPage.py. I can get "find_elements_by_??" in test class only. Please provide guideline Thanks Javed

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Javed, you can extend test class in loginPage (Inheritance). Pls check a example of inheritance here - www.w3schools.com/python/python_inheritance.asp

    • @mukeshrai2004
      @mukeshrai2004 5 років тому

      @Raghav Pal I am facing the same problem

    • @mukeshrai2004
      @mukeshrai2004 5 років тому

      @@RaghavPal but you didn't any inheritence there

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

      No, but it can be done

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

    Very good tutorial , any video how to create a web from basic by sampling

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

      Hi Awaluddin, what exactly are you looking for, Can check the tutorials here - automationstepbystep.com/

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

    Excellent tutorial!!! Thank you very much!!!

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

      Most welcome Andres

  • @tfbarrett2004
    @tfbarrett2004 5 років тому +1

    Great video. Could you please add on to this video by showing how to implement Behave into a framework like this? Thank you!

    • @RaghavPal
      @RaghavPal  5 років тому +2

      Hi Tim, sure I will work on this in some time

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

    This video is so lucid. Thank you! one doubt- reports are not generating for me. I am running script from IDE. Is it necessary to execute script using command prompt in order to get the report generated? Please answer.

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

      Hi Sweta, thanks for watching, there are some reporting lib that work from cmd line I must have shown some examples may be in later videos on how to generate reports from IDE

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

      @@RaghavPal thanks a lot, Raghav. I generated default report from the console. That also helped me. 😊

  • @rkn3383
    @rkn3383 5 років тому +1

    Excellent

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

    HI Raghav I want to learn Selenium step by step can you contact me

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

      Hi Ankit, you can check the training here - automationstepbystep.com/

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

    Yes Sir, it is really helpful.
    Thank you very much 😊

  • @manikandan-dz8fp
    @manikandan-dz8fp 5 років тому

    It is opening new tab with existing chrome session and not opening new Chrome browser for me. also not feeding the URL and throwing error as "selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed" could you please help?
    Windows 10 - sony vaio
    Package Version
    --------------- -------
    behave 1.2.6
    cx-Oracle 7.1.3
    html-testRunner 1.2
    Jinja2 2.9.5
    MarkupSafe 1.1.1
    parse 1.12.0
    parse-type 0.4.2
    pip 19.0.3
    selenium 3.141.0
    setuptools 40.8.0
    six 1.12.0
    urllib3 1.25.2

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Mani, try using a diff ver of chrome driver

  • @zeeehnbugattiisyeah8294
    @zeeehnbugattiisyeah8294 6 років тому +1

    Hey, good Tutorial!
    But I have one problem. Sometimes, when I inspect an element, it has no ID or name. How can I still define it for my program?
    Thanks

    • @RaghavPal
      @RaghavPal  6 років тому +2

      You can generate an xpath for it. Watch this video - ua-cam.com/video/8V74PsFupis/v-deo.html

    • @zeeehnbugattiisyeah8294
      @zeeehnbugattiisyeah8294 6 років тому +2

      Great! Thank you so much!

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

    Hi sir, I am not able generate HTML report even after using "import HTMLTestRunner". In command prompt it says the requirement is satisfied. Please help

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

      Hi Prabhu, pls check if you installed the library using -g argument, this is for global
      Can try to reinstall and check

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

      @@RaghavPal Thanks for the reply. It's working now

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

    please mentioned that install pycharm and please also start from new so we can understand it

  • @SingleMalt-OnePuffOneSip
    @SingleMalt-OnePuffOneSip 3 роки тому

    Hello Sir and all... i have a question - how to run same unit test for two different IP address or URL?? how can iterate the code by passing two URLs

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

      Hi Mahesh, you can do a data driven test and loop for the rows of data

    • @SingleMalt-OnePuffOneSip
      @SingleMalt-OnePuffOneSip 3 роки тому

      @@RaghavPal thank you so much Raghav. I am new to selenium. But it helped me alot.

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

    Raghav, how to do same unit test set up in VSCODE IDE ?

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

      I will check and plan a session for that, For now can check some examples online

  • @TaiNguyen-ev2lb
    @TaiNguyen-ev2lb Рік тому

    Wonderful tutorial! Btw I got this problem. Everything ran just fine in PyCharm but when I tried to run the test in cmd, I got ModuleNotFoundError and it indicated that when importing HomePage, it can't find module "SampleProject" (from what I have imported: from SampleProject.POM.Pages.home_page import HomePage). I hope you see my comment and maybe give me some recommendations. Many thanks Raghav !

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

      Hi Tai
      The ModuleNotFoundError typically occurs when the Python interpreter cannot find the module you are trying to import. This issue can arise due to different factors, such as incorrect module structure, incorrect module name, or incorrect PYTHONPATH configuration.
      Here are some steps you can take to resolve the ModuleNotFoundError issue:
      Verify the module structure: Double-check the directory structure of your project, specifically the location of the SampleProject module. Ensure that the module is located in the correct directory and that its name is spelled correctly.
      Check import statement: Verify that the import statement is correct and matches the module structure. Ensure that the module name (SampleProject) matches the actual module name and that the file (home_page.py) exists within the module.
      PYTHONPATH configuration: Check the PYTHONPATH environment variable to ensure it includes the directory where your SampleProject module is located. The PYTHONPATH variable tells the Python interpreter where to search for modules. You can set it as an environment variable or within your script using sys.path.append().
      Run the script from the correct directory: Make sure you are running the script from the correct working directory. If your script relies on relative imports or assumes a specific directory structure, running it from a different location can cause import errors.
      Check Python interpreter: Ensure that the Python interpreter used in PyCharm is the same as the one used in the command prompt. If you are using a virtual environment in PyCharm, make sure the same virtual environment is activated in the command prompt as well.
      Install dependencies: If the SampleProject module relies on any external dependencies, ensure that those dependencies are installed in the Python environment you are using in the command prompt. You can use pip install to install any missing dependencies.
      By following these steps, you should be able to resolve the ModuleNotFoundError issue and successfully run your Selenium Python project in the command prompt.

    • @TaiNguyen-ev2lb
      @TaiNguyen-ev2lb Рік тому

      @@RaghavPal Hi Raghav, thank you so much for your advice, I fixed it! However, I got a new problem. Whenever I tried to run the whole file, the 1st test case ran well but it cannot run the next test case and cause error: selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id. I think there are something wrong with the tearDown method cause if I comment the cls.driver.close() and cls.driver.quit(), all the test case ran fine. But yes, if the tearDown has nothing in it, it's not a good practice for selenium. So do you have any ideas? Tysm again

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

      The "invalid session id" error typically occurs when the WebDriver session is closed or terminated before attempting to execute another test case. This can happen if you explicitly close or quit the WebDriver session in the tearDown method.
      To resolve this issue, you can modify your tearDown method to handle the WebDriver session appropriately. Here are a few suggestions:
      Separate the tearDown method for each test case: Instead of having a common tearDown method for all test cases, create a separate tearDown method for each test case. This way, the WebDriver session will be closed after each test case, ensuring a fresh session for each test.
      Use the tearDownClass method: Instead of using the tearDown method, you can use the tearDownClass method, which is called once after all the test cases in the test class are executed. This way, the WebDriver session will be closed after all the test cases are completed.
      Handle exceptions in the tearDown method: If you want to continue executing the remaining test cases even if an exception occurs in a specific test case, you can catch the exception in the tearDown method and handle it gracefully. This way, the WebDriver session will still be closed properly, allowing the subsequent test cases to run.
      Here's an example of how you can modify your code:
      import unittest
      from selenium import webdriver
      class MyTestClass(unittest.TestCase):
      @classmethod
      def setUpClass(cls):
      cls.driver = webdriver.Chrome()
      cls.driver.maximize_window()
      def test_case1(self):
      # Test case 1 code
      def test_case2(self):
      # Test case 2 code
      @classmethod
      def tearDownClass(cls):
      cls.driver.close()
      cls.driver.quit()
      if __name__ == '__main__':
      unittest.main()
      Make sure to adapt the code to fit your specific test case structure. By properly managing the WebDriver session in the tearDown or tearDownClass methods, you should be able to avoid the "invalid session id" error and execute multiple test cases successfully

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

    Thank You Raghav it's Informative

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

      Thanks and welcome Naga

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

    Everything works fine except Html reports, followed exact same steps, but reports are not getting generated (MAC os)

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

      Hi Biplab, what is the error. Also check again with the video, if any step was missed

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

      @@RaghavPal Hey Thanks for quick reply, i was running the old configuration in pycharm, hence the __main__ section wasnt getting executed, I ran from terminal, and was able to generate the reports. This tutorial was very informative, Thanks a lot
      Could you please share if you have any training on writing feature test cases with Selenium in Python using POM

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

    Can you please tell this framework name?

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

      Hi Sathish, it is a modular POM framework

  • @heatherkoo3043
    @heatherkoo3043 5 років тому

    Hi, can I ask why the orangeHRM demo page is not in English? Is it only me? The webpage is in Spanish or something. How can I change this?

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Heather, try this - opensource-demo.orangehrmlive.com/. It is a public demo website, so cannot control it.

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

      Automation Step by Step - Raghav Pal
      Raghav is there a way you can show in Bdd with pageobject

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

    wonderful video, thankyou veryyy much

  • @nehadubey221
    @nehadubey221 5 років тому +2

    This is a great tutorial, helped me to build a framework on my own. Thank you. I do have a question. How do I read text on a button on a page? I tried using find_element_by_name but it don't work.

    • @Beingsilentspeaker
      @Beingsilentspeaker 5 років тому +3

      Use this..
      Element = driver.find_element_by_id("some name")
      Print(Element.text)
      Hope dis will help you...

    • @RaghavPal
      @RaghavPal  5 років тому

      Thanks for your inputs Satheesh. Neha, hope this is useful

    • @nehadubey221
      @nehadubey221 5 років тому

      Satheesh Kumar Thankyou for your help. In my case there was no id on the button so I finally used the combination of name and value as it is unique and it worked.

    • @nehadubey221
      @nehadubey221 5 років тому

      @@RaghavPal @Satish I got the other issue working however now I am facing another big issue. How do I check for the existence of a modal/dialog. It is not an alert so I cannot use switch_to alert method. The html element I am speaking of has following arguments: role=dialog aria-labelledby=label aria-describedby=description. Any hints wold be highly appreciated. Thank you.

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Neha, is this site accessible publicly? You can check this
      stackoverflow.com/questions/19003003/check-if-any-alert-exists-using-selenium-with-python
      huddle.eurostarsoftwaretesting.com/selenium-interact-modal-windows/sqa.stackexchange.com/questions/26130/java-selenium-check-if-modal-popup-present

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

    how can i read data in send keys from excel again and again?? could you please explain

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

      Hi Ataullah, This will help - allselenium.info/read-data-from-excel-in-python-scripts/

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

      @@RaghavPal Hi Raghav Thank you for your reply, can i have a personal coaching for selenium python?
      if you can i would be grateful to you

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

      Hi Ataullah, I will plan to take personal classes in some time. As of now you can refer the tutorials here automationstepbystep.com/