html,css,ruby,watir,page-object-gem
To locate the ok use: footer .app-txt To locate the oops use: .meta .app-txt footer .app-txt {color: red;} .meta .app-txt {color: orange;} <footer> <div class="application" style="opacity: 1;"> <div class="txt" style="background-color: transparent;"> <span class="app-txt" style="background-color: transparent;">ok</span> </div> </div> </footer> <div class="meta"> <div class="application" style="opacity: 1;"> <div class="txt" style="background-color: transparent;"> <span...
ruby,watir,watir-webdriver,page-object-gem
Due to the accessors methods being created when the class is evaluated, you cannot use the accessors for elements you need to dynmically locate. For more details, you can see the feature request - Issue 203. An alternative approach is to use the page object's regular locator methods. For example,...
The names (:first_name, :last_name, :birth_date) are only used to generate the method names such as first_name=, last_name= and birth_date=. The name is not stored or retained for later use. That said, you could iterate through the page's instance methods to find the text fields. The following text_fields method will: Get...
ruby,watir,watir-webdriver,page-object-gem,rspec-expectations
It looks like this line: @sltedStudy = page.select_list_element(:id => 'cntrStudy', :frame => frame).selected_options(&:text) gives an array of text from selected options: ["SLC"] try changing your rspec to this: expect(page.cell_element(:xpath => "//td[.='Lorem Ipsum']/following-sibling::td[1]", :frame => frame).text).to be == @sltedStudy.first or this: expect([page.cell_element(:xpath => "//td[.='Lorem Ipsum']/following-sibling::td[1]", :frame => frame).text]).to be == @sltedStudy...
ruby,watir-webdriver,pageobjects,page-object-gem
Div elements do not usually need to be clicked, which is why the page object accessor creates a membership method to return the div text rather than click it. To click it, you can directly call the click method: membership_element.click ...
ruby,watir-webdriver,page-object-gem
It seems like a bug and should be raised as an issue for the project (https://github.com/cheezy/page-object/issues). In the short term, you could work around the issue by calling wait_until directly against the Watir::Browser, which is returned by the page object's browser method: browser.wait_until { login_button? }...
watir-webdriver,page-object-gem
That type of behaviour often is often triggered by an 'onblur' event. You can manually trigger this use the page object element's fire_event method. def enter_my_info(data) self.txtinput = data self.txtinput_element.fire_event('onblur') end If that does not work, you could try mimicking the user behaviour and input a tab character. You can...
ruby,page-object-gem,rspec3,rspec-expectations
The Page-Object gem's attribute method does not do any formatting of the attribute value. It simply returns what is returned from Selenium-WebDriver (or Watir-Webdriver). In the case of boolean attributes, this means that true or false will be returned. From the Selenium-WebDriver#attribute documentation: The following are deemed to be “boolean”...
The problem in method #parent in FireFox 35.0. Try to use older version or use Chrome.
ruby,selenium-webdriver,watir-webdriver,page-object-gem,pageobjects
The problem is with how the YAML file was being looped. For example, in: KBA.each do |key, value| value.each do |question, answer| end end value is a hash, so the question and answer would not be the expected values. They will actually be key/value pairs. It should have been: KBA.each...
ruby,selenium,watir-webdriver,page-object-gem
Based on the exception message, it is coming from Watir-Webdriver's ElementLocator: VALID_WHATS = [String, Regexp] def check_type(how, what) case how when :index unless what.kind_of?(Fixnum) raise TypeError, "expected Fixnum, got #{what.inspect}:#{what.class}" end else unless VALID_WHATS.any? { |t| what.kind_of? t } raise TypeError, "expected one of #{VALID_WHATS.inspect}, got #{what.inspect}:#{what.class}" end end end...
ruby,selenium-webdriver,yaml,watir-webdriver,page-object-gem
To iterate over a few arrays at once, you can use zip: def enter_data(doc) names, cities, checks = doc['samplepage'].values names.zip(cities, checks).each do |name, city, check| self.sample_name = name # related data self.sample_city = city # related data self.check = check # related data add # added it end submit end...
ruby,refactoring,page-object-gem
I don't see why you wouldn't keep the elements in the page object class. That's kind of the point of the class, right? If they're shared across multiple pages, then I understand putting them in a module and mixing in. But why abstract the unique elements on that page away...
ruby-on-rails,rspec,watir,watir-webdriver,page-object-gem
In the HTML, the element with class "tile" is actually a p element: <p class="tile">Text: Kids </p> As a result, you need to locate it using the paragraph_element method instead of the div_element method: div(:my_title) { div_element(:class => 'con-head').paragraph_element(:class => 'tile') } ...
ruby,watir,watir-webdriver,page-object-gem,pageobjects
Assuming that the nesting is always the same, rather than having the :scar_first_name_error map through each ancestor, you could define each element with respect to its parent (or ancestor). Let us assume the HTML is: <html> <body> <div class="validate-method"> <div class="service-info"> <div class="input-group"> <div class="input-container input-left-half round"> text </div> </div>...
ruby,cucumber,watir,watir-webdriver,page-object-gem
When you use fire_event, you don't give status, but action. page.spnMngUsers_element.fire_event('click') ...
watir,watir-webdriver,pageobjects,page-object-gem
You can use a plural version of your element name to get an array of matching elements. So define something generic enough to capture all your checkboxes, and then create a method to tick the correct number of them. I haven't tested this but I think it would look something...
ruby,watir-webdriver,page-object-gem
A page object has two methods related to getting the URL: page_url_value - This is the URL specified in the page_url accessor (ie the expected URL). current_url - This is the browser's current URL. To check that the correct page is displayed, then you want to check the current_url. The...
You could use an XPath with the following-sibling axis to find the values of adjacent cells. For example, the following page object has a method that will find the label cell based on its text. From there, navigate to the next td element, which should be the associated value. class...
ruby,watir,watir-webdriver,page-object-gem,rspec-expectations
In Watir-Webdriver, the Element#style method can be used to get an element's computed style. The computed style is the element's appearance based on style sheets and their style attribute. Assuming the HTML is like: <html> <head> <style> .MenuItem { background-color: #c0c0c0; } </style> </head> <body> <table> <tr> <td class="MenuItem">menu</td> </tr>...
ruby,cucumber,watir,watir-webdriver,page-object-gem
As best as I can tell you have two separate issues. Firstly, I have no idea how you set your browser variable to a page object instance. The Page Object Module definitely sets browser as a readable attribute. So if the code is within a class that has import PageObject,...
ruby,rubygems,watir-webdriver,page-object-gem
Your method should looks like this: def create_element(x) div_element(:id => "something-#{x}") end Method #div is Accessor. It only defines methods for you. It's been desigened to be used in the field of a class....
ruby,selenium-webdriver,watir-webdriver,page-object-gem
Looking at their basic usage docs, it seems like calling table :groupsList, id: 'manage-groups-list' generates an instance method rather than a class method. So you would need to call the generated method like so: b = Watir::Browser.new :chrome page = ManageGroupsPage.new(b) # build a new page object page.groupsList # call...
cucumber,watir,watir-webdriver,page-object-gem,rspec-expectations
The one thing I do not like about manually writing a loop to iterate through and validate each cell is that you only see the result of the first failure. If there are say two cells that are blank, the test failure will only show one. As a result, I...
ruby,watir,watir-webdriver,page-object-gem,rspec-expectations
Assuming that the sltMembers_element method is the one generated by the select_list accessor, then the page-object will have 5 methods: sltMembers returns the currently selected item text. sltMembers= selects an item. sltMembers_element returns the page-object element. sltMembers? checks if the element is present. sltMembers_options gets an array of all available...