README.md in web-object-0.4 vs README.md in web-object-0.5

- old
+ new

@@ -3,11 +3,14 @@ Create page-object style test framework using original webdriver flavor. Now what does original webdriver flavor is, it simply means, no additional wrappers, no additional syntax. Hence just create page-objects and start using basic webdriver commands on it. Moral of the story, elements created using web-object gem will be objects of WebElement class and one can perform all webdriver -commands on it like send_keys, click, displayed? .. and so on... +commands on it like send_keys, click, displayed? .. and so on... + +WebObject gem is completely compatible with Appium and can also be used for ruby-appium frameworks, to sound a little more mobile-like, WebObject class has an alias called **AppObject** to be used instead PageObjects in case of Mobile frameworks.. + ## Table of Contents - [Installation](#install) - [Install using gem command](#gem) - [Install using bundler](#bundler) @@ -133,14 +136,15 @@ * __Finding single element will return Boolean false if error paramter is sent as false and element not found on the page.__ * __Finding multiple elements will raise exception if error paramter is sent as true and element not found on the page.__ ## <a name="usage"></a> Usage :eyes: -Now as we saw how to create page objects, lets see how to put it to practical use. +Now as we saw how to create page objects, lets see how to put it to practical use. +**Web Usage** ``` -class Login < WebObject +class LoginPage < WebObject element :login_email, {:id => "email"} element :login_password, {:css => "#pwd"} element :login_button, {:xpath => "//button[@id='signin']"} elements :active_users, {:css => ".users>#active"} @@ -153,11 +157,20 @@ def get_active_user_count active_users.size end end ``` - + +**App or Mobile Usage** +``` +class LoginScreen < AppObject + element :username_field, {accessibility_id: "username"} + element :password_field, {predicate: 'name=="password"'} + element :login_button, {class_chain: "**/XCUIElementTypeButton[`value=='Log In'`]"} +end +``` + ## <a name="webconditions"></a> WebConditions :eyes: Always envied the fancy ExpectedConditions class which Java and Python has where they smoothly pass a condition within the WebDriver explicit wait object... And when it comes to Ruby, you need to go through a painfully lenghty procudere of creating your own method or fallback to other framweworks like Capybara or Watir loosing the original WebDriver flavor. Well, not to worry as web-object gem to the rescue. @@ -181,10 +194,14 @@ ## <a name="alias"></a> Aliases :eyes: There is an option to use PageObject class instead of WebObject. Eg: -``` class LoginPage < PageObject ``` +``` class LoginPage < PageObject ``` + +There is an option to use AppObject class instead of WebObject to sound more mobile-like for appium frameworks. +Eg: +``` class DashboardScreen < AppObject ``` Also for elements as mentioned above for `element` there is an option to use `find` (for capybara flavor loving people) for `elements` there is an option to use `element_list` or `all`