The code that we have learnt to write earlier can be quite verbose. To clean up our code, we can start to use Page Factories. This allows us to annotate variables in our page objects with how to search the page.
This means that we don't have to have full
WebElement element = driver.findElement(...); code all over the file. We can change it to:
As you can see this can make our code slightly easier to read and therefore more maintainable. If you regularly use other languages like Ruby or Python, you will notice that they don't have the PageFactory support project. This is because those languages don't have Factory constructs in the language. They are not idiomatic and therefore not in the language.
To use the PageFactory project in WebDriver, we will have to make sure that the we have added it as a dependency.
Let us now update our previous code from with an example of the PageFactory.
Selenium Related Interview Questions
|SILK TEST Interview Questions||QTP Interview Questions|
|JMeter Interview Questions||Automation Testing Interview Questions|
|Software testing Interview Questions||JUnit Interview Questions|
|TestNG Interview Questions||SAP Testing Interview Questions|
|Selenium WebDriver Interview Questions||Selenium IDE Interview Questions|
|QUnit Testing Interview Questions||Performance Testing Interview Questions|
|Hadoop Testing Interview Questions|
Getting Started With Selenium Ide
Overview Of Selenium Webdriver
Working With Webdriver
Getting Started With Selenium Grid
Advanced User Interactions
Working With Html5
Migrating From Remote Control To Webdriver
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.