info:To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
Page Objects as implemented in the existing framework require you to define methods to perform actions on elements. (Usually one-liners)
```ruby
defset_first_name(first_name)
fill_element(:first_name,first_name)
end
defclick_continue
click_element(:continue)
end
it'sets first name and clicks continue'do
Page::Form.performdo|form|
form.set_first_name('First Name')
form.click_continue
end
end
```
Page Libraries make this more efficient by providing methods based on the page's elements, making extra methods unnecessary.
```ruby
it'sets first name and clicks continue'do
Page::Form.performdo|form|
form.first_name='First Name'# sets the first_name
form.continue# clicks Continue
end
end
```
Consider if we needed to validate the text of the `First name` field using Capybara. We'd need to add a one-liner to fetch the text:
```ruby
defget_first_name
find_element(:first_name).text
end
Page::Form.performdo|form|
form.set_first_name('First Name')
expect(form.get_first_name).toeq('First Name')
form.click_continue
end
```
Instead, because the page library automatically creates methods from page elements, we can fetch the text by calling `first_name` without writing code to define the method ourselves:
```ruby
Page::Form.performdo|form|
form.first_name='First Name'
expect(form.first_name).toeq('First Name')
form.continue
end
```
### Element Naming Convention
Since the element type is preserved within the Page Library, there is no need to specify a `_field` or `_button` suffix to the data-qa-selector.