FAQ Database Discussion Community


Access to page methods within section

ruby,watir-webdriver,page-object-gem
Now sections are threaded as elements with some other elements in it but this approach makes unable to use page methods inside sections: wait_until { login_button? } will raise NoMethodError: undefined method 'wait_until' for Watir::HTMLElement Is there anyway to access page methods inside section class?...

Trying to load a yaml file, iterate through the hash and execute some logic

ruby,selenium-webdriver,watir-webdriver,page-object-gem,pageobjects
Trying to load a yaml file, iterate through the hash and execute some logic. I'm using Watir-Webdriver/Ruby to answer randomly selected questions, the questions/answers are known and stored in a YAML file (kba.yml). I'm using Ruby/Page Objects/YAML file/Watir-Webdriver. My YAML file (kba.yml): 1: question: "Which of the following is a...

How can page-object-gem be used with IRB?

ruby,selenium-webdriver,watir-webdriver,page-object-gem
Using watir-webdriver, you can test your code while developing using IRB (interactive ruby). But this does not seem to work when using the page-object gem. When I run the ruby program, I can see my page-object calls are working. This is not apparent from IRB. E.g. Here's what I type...

Get the actual value of a boolean attribute

ruby,page-object-gem,rspec3,rspec-expectations
I have the span: <span disabled="disabled">Edit Member</span> When I try to get the value of the disabled attribute: page.in_iframe(:id => 'MembersAreaFrame') do |frame| expect(page.span_element(:xpath => "//span[text()='Edit Member']", :frame => frame).attribute('disabled')).to eq("disabled") end I get: expected: "disabled" got: "true" How do I get the value of specified attribute instead of a...

Unable to locate nested p element

ruby-on-rails,rspec,watir,watir-webdriver,page-object-gem
How would I locate the "tile" element in the HTML: <div class="con-head"> <div class="up-at js-con-dates"> <span class="bold">Last date</span> 7:13 PM <br> <span class="bold">Save</span> 7:12 PM </div> <p class="tile">Text: Kids </p> <p class="desc js-desc" style="">Q&A </p> </div> I tried to locate it with the accessor: div(:my_title) { div_element(:class => 'con-head').div_element(:class =>...

How to locate element inside css footer

html,css,ruby,watir,page-object-gem
There are 2 text on page "ok" and "oops" one is under <footer> another under class=> 'meta'. I want to verify footer text and I am using span(:alert){div_element(:class => 'application').div_element(:class => 'txt').span_element(:class => 'app-text')} but its verifying with meta "class" text "oops" as both have same div path. How I...

Can't execute 'onclick' using 'fire_event'

ruby,cucumber,watir,watir-webdriver,page-object-gem
I have a div menu which is hidden. Div includes a span with onclick: onclick="parent.ClickMenuItem(this, '', 'http://some_link', 0); parent.wndPopupbtnMenu.hide(); When I try to execute it via fire_event nothing happens. But step becomes to passed. page.spnMngUsers_element.fire_event :onclick Page object of spnMngUsers: in_iframe(:id => 'PortalSubmenuFrame') do |frame| span(:spnMngUsers, :xpath => "//span[text()='Users']", :frame...

Cleaning up massive amount of PageObject elements

ruby,refactoring,page-object-gem
Each of our page objects has around 80-100 PageObject elements defined. This is a byproduct of a very data centric application and I don't see that changing any time soon. We have many text fields, select lists, buttons, and menus. I want to clean up these somehow and put them...

Use page-object gem to check a box in a table

watir,watir-webdriver,pageobjects,page-object-gem
My page has a table with a checkbox in the first column. I want to check the box in each row up to a given number. I can do this in watir-webdriver, but not with page-object; possibly due to the HTML structure. HTML - edited for relevancy (there is more...