Custom Elements & Custom Locators with Selenium
Are you still using the standard WebElement?
Ok.. We will discuss about customizing selenium standard WebElement to your own type.
In this world you will have TextBoxes, Combos , Buttons and all.. even a big HTML table will be a single element.
So you will have a bunch of specific actions inside your customize element.
In Your Page Object.
@FindBy(how = How.ID, using = "myTable") public Table myTable;
In You Script
myTable.getCellText(3,4); //will return 4th item at 3rd column. myTable.getCellText("size",5); //returns 5th item of Size column .. wow! , you can write you're own action!
Is that All?
No! we will further discuss about Custom Locators as well!
It's your element! and you know the best way to locate it
So if you need to do something beyond XPATH , you can write your own logic to locate your element.
Cheers! See you there at the session!
Outline/structure of the Session
- Basics of WebElement
- Bit about PageFactory
- Implement your own FieldDecorator
By attending this session you can create your own custom element to make life more easier. Custom elements always encourage more re-usability.
Bit techy people