JUnit Selenium Webdriver Tutorial 15 (Page Factory) | QAShahin

preview_player
Показать описание
JUnit Selenium Webdriver Tutorial 15 (Page Factory) | QAShahin

Java JUnit WebDriver video tutorial on implementing the Page Factory pattern when writing WebDriver JUnit tests.

Resources:
Introductory music:

Introductory video background:
Рекомендации по теме
Комментарии
Автор

Please, dont stop sharing your experience =)
Thank you very much!

MrKellindill
Автор


I am using C# but this was very useful. cheers mate

kaysi
Автор

Nice video, but i've got one question. If I have more than one method in the testPage, should all of them return PageFactory? Or should the be daclared as void?

ВадимТроллев
Автор

Hi,

Very informative and I certainly appreciate the effort you've put into putting these videos together! Quick question: Is there a reason you aren't tacking the WebElements for homePageLink and contactPageLink, (along with the @FindBy annotations), into the AbstractPage class? I would think you would want that data in one place to make it easier to maintain.

Thanks!

allenbrokeit
Автор

Hello,

Thanks for all your wonderful videos.You can't imagine the amount of knowledge you are impacting on the selenium community for free.More power to your elbow. I have a scenario where I am populating a registration form with data and I have used page object to create methods for all the web elements on the form and call each method inside the test method.Firstly I don't think that approach is the best..but that is by the way, could you please explain?If I were to use the Page Factory pattern to populate the form and call each method in the test method like I did for the Page Object. Thanks.

folaakingboye
Автор

Oh boy.. I'm stucked here. I tried to implement the page factory pattern on the pageobjects and I always got nullpointer exception. I've just modify all return new classname rows to the initelements and my basic functions doesn't work. (e.g: Simple navigateToContactPage method throw this error. What should I do? I appreciate your help. Thanks.

fantabarack
Автор

Hello, I'm learing Jave and this my perhaps day 6. I was going thru the videos and I think I struck gold by finding your page object pattern video and now the page factory. I successfully implemented the page object pattern (Watch that video 3-4 times, learning constructors and methods :)). I'm now trying to implement the pagefactory, however it appears that I'm running into some null pointer issues. I'm new to this community. Would that be appropriate for me to post my issue here?

ParmanuKumarSanghParmeshwar
Автор

I think it would be good to encapsulate PageFactory.initElements() method inside AbstractPage class and instead expose a method for subclasses only with one generic parameter - page class.

valde_mar
Автор

please post TestNg videos like parallel execution on multiple browsers and grouping execution 
Thanks in Advance

sreenathnaidu
Автор

Well, it looks (unfortunately) that the last train left the station many years ago.
Nevertheless, I have a question which is probably derived from the fact of missing the entire concept.
Anyway, here is the question...
Lets take a look at the ContactPage class code:

01 public class ContactPage extends AbstractPage {
02 @FindBy (name="nav_home")
03 WebElement HomePageLink ;
04
05 public ContactPage (WebDriver driver) {
06 super(driver);
07 }
08
09 public HomePage navigateToHomePage () {
10 HomePageLink.click();
11 return PageFactory.initElements (driver, HomePage.class);
12 }
13 }
My understanding is that initElements() method of built-in PageFactory class should be always used to initialize web elements. If so, what line #11 does? Initializing web elements of HomePage object, i guess. But how (i.e. where) HomePageLink web element (lines #2, 3) is initialized in order to execute line #10? Thanks

alexm
Автор

Hello,

Thanks for this videos, helped me much.

You can do a video in wich you explain how we do a util class? I want to make a class in wich i want to keep all main commands with throw Exception.

EX: public void clickButton(string button) throws Exceptions }{
try {
button.click...
} catch (NoSuchElementException ex) {
system.out.println ("element doesn't exist")

Thanks! :)

gnDragos