Highlight feature of Qxf2’s Page Object Model framework

Are you lost with locating the web elements while debugging your test script?  The highlight feature of Qxf2’s Page Object Model framework helps you to debug locators by giving a visual clue. This blog post will guide you with the steps involved in using the highlight feature of Qxf2’s Page Object Model framework in your test script.

The highlight feature in our framework will give you a visual clue of the test flow. On enabling the highlight feature, the web elements under test will be highlighted during test execution. A locator might match with exactly a single web element on a web page. It might match with multiple web elements as well like in the case of reading data from a table. The highlighting feature has been implemented for both scenarios.

Steps to invoke the highlight feature in your test script are:

  1. Fork and clone the Qxf2’s Page Object Model framework and follow the setup instructions detailed out in the Readme.md file. To jump start with creating your new project with our framework, you can refer to this blog post: How to start using the Qxf2’s framework with a new project
  2. Edit your test script to turn on or off the highlight feature as needed. Call the turn_on_highlight() method to enable the highlighting feature. Similarly, call the turn_off_highlight() method to disable the highlighting feature of the framework in your test script. The test script namely, test_example_form.py in our framework has been updated to include this feature
  3. Run your test script and you will have a visual highlighting that shows the flow of your test. A sample run of our test script namely, test_example_form.py is as follows:
    Open Git Bash and execute pytest -k example_form command. You will see the visual highlighting of the web element under test as in the image below.‌

Test result showing highlighting of web element


I hope this post helps you with debugging your test script!


3 thoughts on “Highlight feature of Qxf2’s Page Object Model framework

  1. Hello there,
    Can you please tell me which file actually contains the actual code that defines the highlight feature?
    I followed the link in this file: test_example_form.py and only found these two methods below that set the instance variable to True or False.
    def turn_on_highlight(self):
    “Highlight the elements being operated upon”
    self.highlight_flag = True

    def turn_off_highlight(self):
    “Turn off the highlighting feature”
    self.highlight_flag = False

    1. Hi Aziz,
      The Base_Page.py under page_objects in our Qxf2-page-object-model contains all the methods related to the highlight feature.
      It is sufficient to turn on or off the feature by calling the methods turn_on_highlight() OR turn_off_highlight() accordingly in your test script to use this highlight feature.
      Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *