page-object-gem

how to combine a table headers and rows in to a map using ruby?

核能气质少年 提交于 2020-01-23 13:18:31
问题 While using the pageobject gem am able to get the a headers and rows of a table but am unable to convert it into a hash using the below code am able to get only first row mapped to headers but I need complete table rows mapped to the header. Here is the link for the table data: https://www.w3schools.com/html/html_tables.asp I have tried the below code: class WbPage include PageObject page_url 'https://www.w3schools.com/html/html_tables.asp' table(:customers, id: 'customers') def get_table

Where is the list of the cheezy page-object dynamic element finders?

别来无恙 提交于 2020-01-16 11:32:13
问题 As a reference I am referring to this post. It basically says instead of saying text_field(:tf_elem, id:'id1') . We can do text_field_element(id: 'id1') . I definitely prefer the latter. It also works for multiple elements so text_field_elements . I can't seem to figure out how to do it for radio buttons. I'm trying radio_elements but not working. Undefined method. Frustratingly enough I can't find this information documented anywhere else. How do I get it to work for radio buttons and is

Get the actual value of a boolean attribute

南笙酒味 提交于 2020-01-06 01:30:23
问题 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 boolean value? 回答1: The Page-Object gem's attribute method does not do any formatting of the

Accessing a nested element 3 levels deep using page objects

Deadly 提交于 2020-01-05 10:32:35
问题 Using the Page Object model and gem I want to access an element that is nested 3 layers deep. I've successfully accessed nested elements that are 2 elements deep but for 3 the same method isn't working. 3 elements defined in my Page Object: div(:serv_info, :class => "service-info") div(:validate_method, :class => "validate-method") div(:scar_input_group, :class => "input-group") So I tried to chain those 3 elements to access the div class input-container input-left-half round like this: div(

page-object gem seems not working

泪湿孤枕 提交于 2019-12-25 04:53:15
问题 I am trying to use page-object gem in my watir-webdriver scripts and I think I might be missing something. Here is my code for log_in.rb: require "./all_deals" class LogIn include PageObject text_field(:email, :id => 'UserName') text_field(:password, :id => 'Password') checkbox(:remember_me, :id => 'RememberMe') button(:log_me_in, :value => 'Login') def initialize(browser) @browser = browser end def log_in (email, password) self.email = email self.password = password remember_me log_me_in

Cheezy Dynamic Finder for Page Section

冷暖自知 提交于 2019-12-24 20:15:50
问题 I'm on ruby using the page-object-gem by cheezy. Following the excellent answer here, I decided to ask this question (a page_section isn't an element I think). Anyway what is the syntax for the dynamic finder/locator for a page_section and page_sections ? 回答1: I do not believe this scenario was considered in the original design, so there is not great support. Feel free to request it at https://github.com/cheezy/page-object/issues . That said, you could use the internal platform object's #page

How to avoid Compound Class name error in Page Object?

我们两清 提交于 2019-12-17 15:51:32
问题 When I try to use the class name that having space class = "country name" in page object, I'm getting: Compound class names not permitted Selenium::WebDriver::Error::UnknownError) How can I use the class name that having space. Eg: class = "country name" 回答1: Use a CSS selector instead: .country.name The important thing to note is that this example is wrong! If "country name" is meant as a name of a country, that is. Class names can't have spaces in them. In fact, the class attribute is a

How can I get some particular link form the links collection

流过昼夜 提交于 2019-12-13 04:37:52
问题 I'm using watir-webdriver have several lines of the same code shown below: ... <p class="schedule-text"> by <a href="http://www.somesite.com">MarketingClub</a> in <a href="http://www.somesite2.com">Marketing</a> </p> I need to get the first links included in p tag and the second links included in p tag so using page object I've added the following code: links(:followees_category, :css => "#home-followees li.animate-in ul li[data-show-id] p.schedule-text a") ... followees_category_elements

Accessing a table within a table (Watir/PageObject)

一个人想着一个人 提交于 2019-12-13 01:15:13
问题 I'm running Watir-webdriver with Cheezy's PageObject for Cucumber testing. I am new to ruby, testing, pageobjects, and watir. I am trying to access a table. Specifically, I'm trying to click an image in the 7th column. This is my code: tables.downcase! tables.gsub!(/\s+/, '_') tables_elements = self.send("#{tables}s_elements") the_table = tables_elements[table_number] the_table[row_number][column_number].click With this code running, it becomes apparent that it believes the table (columns,

how to click a link in a table based on the text in a row

邮差的信 提交于 2019-12-12 09:22:14
问题 Using page-object and watir-webdriver how can I click a link in a table, based on the row text as below: The table contains 3 rows which have names in the first column, and a corresponding Details link in columns to the right: DASHBOARD .... Details EXAMPLE .... Details and so on. <div class="basicGridHeader"> <table class="basicGridTable">ALL THE DETAILS: ....soon </table> </div> <div class="basicGridWrapper"> <table class="basicGridTable"> <tbody id="bicFac9" class="ide043"> <tr id="id056">