There are two things that are of the most importance when it comes to automation & Page Object design:
1. Understanding the layers and abstractions in framework design
2. Understanding of how to model page objects
This video will teach you how to use Python to abstract and separate layers for highly scale-able framework design. You need to know this before you can begin building page objects because when building Page Objects, you should always be referencing your own code. Almost never should you be referencing 3rd party libraries from your Page Objects (Yes, that exactly what I'm saying, you should not even be importing Selenium Webdriver in your Page Objects), and in your tests you should only be referencing your Page Objects.
Level 1 abstractions are covered in more detail in those two videos and those are the only two classes that should directly import and use Selenium Webdriver library:
Browser: • Advanced Webdriver - Wrapper for Brow...
UiObject: • Advanced Webdriver - Wrapper for UI O...
Next you need to understand that when you build Page Objects, you build an API for you and your team to utilize anytime they/you want to do something on a given page. So build it to be intuitive and usable for any use case possible on that page and not just for the most common use case that you envision on the page at that time.
How do you do that? You create small dumb functions for everything that your page supports (any small user action) and anytime you model a page, break it up into smallest components.
Is there a drop-down on a page? Model the drop-down to be its own class so it can be instantiated with parameters and used on any of your pages.
That drop-down component may support generic methods such as:
get_available_selections()
get_current_selection()
open()
select(value)
close()
is_enabled()
and so on...
The same can be done for any other component and I have even created multiple videos that show how to do it for the following page components:
Tables: • Selenium Webdriver - Tables
Dropdowns: • Advanced Webdriver - Dropdowns
Checkboxes: • Advanced Webdriver - Checkboxes
Radio buttons: • Advanced Webdriver - Radio Buttons
The more components you have, the higher development velocity you will achieve. It will get to the point where a new page can be modeled within minutes.
If you like what I teach, make sure to support me:
via Patreon: / arturspirin
via PayPal: https://goo.gl/jYc1Mu
Also, make sure to checkout Test Junkie and leave a star @ https://github.com/ArturSpirin/test_j...
Смотрите видео Page Objects - Advanced Selenium WebDrvier Tutorial [Python] онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Artur Spirin 21 Апрель 2019, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 11,973 раз и оно понравилось 200 людям.