oz icon indicating copy to clipboard operation
oz copied to clipboard

try to dynamically find the element type from xpath

Open Castone22 opened this issue 7 years ago • 7 comments

Attempts to reduce replication by checking if the element type is present within the xpath if it's provided, then passes that as a watir element, still supports manual overriding failing an auto detection.

Currently:

add_static_text(:mission_statement, element_type: :h2, xpath: '//section[@class="main-content"]//h2[@class="fancy-text"]')

Given the element type was actually provided in the xpath (h2[@class="fancy-text"]]), it makes sense for Oz to be able to infer it from the path, letting us do:

add_static_text(:mission_statement, xpath: '//section[@class="main-content"]//h2[@class="fancy-text"]')

Castone22 avatar Nov 26 '18 21:11 Castone22

No description provided.

greenarrowdb avatar Nov 30 '18 19:11 greenarrowdb

Allows oz to create attempt to infer the element type from an xpath if it is used.

Castone22 avatar Nov 30 '18 19:11 Castone22

That's the 'what' but what is the 'why'? :)

greenarrowdb avatar Nov 30 '18 19:11 greenarrowdb

To reduce replication :)

Castone22 avatar Nov 30 '18 19:11 Castone22

Of what? please provide a use case (yes I know we talked about this one, but I am trying to keep things clean) :)

greenarrowdb avatar Nov 30 '18 19:11 greenarrowdb

Might make sense to make this also work for css selectors... though given they are less likely to specify the exact element type you're looking for, and that they have a less standard format than xpaths, might be a lot of work for very little gain.

Castone22 avatar Nov 30 '18 20:11 Castone22

What is the current status of this merge request? Are we going forward with this pattern, or does it require some discussion?

ThePROX avatar Jul 02 '19 20:07 ThePROX