Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make :xpath and :css equal #244

Merged
merged 4 commits into from
Feb 7, 2014
Merged

Make :xpath and :css equal #244

merged 4 commits into from
Feb 7, 2014

Conversation

p0deje
Copy link
Member

@p0deje p0deje commented Feb 5, 2014

This pull requests brings the following on the table:

  1. :css and :index selectors can be combined (fixes Unable to locate element using :css and :index #241)
  2. :css works on all container methods (fixes :css should work for all container methods, not just #element #124)
  3. :css and :xpath selectors cannot be used together
  4. Removes dead code in xpath builder where index is appended. I still think this should be restored both for XPath and CSS builders, but it's a separate thing to discuss.

Changes for watirspec are in my fork. Please take a look too.

@jarib @jarmo There might be some edge cases or anything that simply didn't come to my mind, so please review the changes. I've also tested this manually a bit. I'd appreciate any code improvements too.

@p0deje
Copy link
Member Author

p0deje commented Feb 5, 2014

Also, some specs actually duplicate each other in spec/element_locator_spec.rb and spec/watirspec/element_spec.rb, but I'm not sure which place is better for them. I'm talking about specs for :xpath/:css + :index selectors.

@jarib
Copy link
Member

jarib commented Feb 6, 2014

Looks good to me.

@p0deje
Copy link
Member Author

p0deje commented Feb 6, 2014

@jarib What do you think about specs?

@jarmo Would you take a look too? I'm not sure if this is consistent to watir-classic.

@jarib
Copy link
Member

jarib commented Feb 6, 2014

I think the specs are fine. It's not like we're duplication-free in the specs anyway, and having things tested in both element_locator_spec.rb and in WatirSpec doesn't really make it worse in my mind.

@jarmo
Copy link
Member

jarmo commented Feb 6, 2014

@p0deje Seems good to me. Good work!

I'm not sure how it works exactly in watir-classic, but i'm afraid that it is already working there the same - e.g. index is used after the fact elements have been located by xpath or css.

p0deje added a commit that referenced this pull request Feb 7, 2014
@p0deje p0deje merged commit 6795e13 into watir:master Feb 7, 2014
@p0deje p0deje deleted the css-emancipation branch February 7, 2014 11:43
@skierpage
Copy link

Great stuff. I stumbled into this because https://github.com/cheezy/page-object/wiki/Elements claims text_field and text_area support css but I get "Watir::Exception::MissingWayOfFindingObjectException".

Could you make a release with this? watir-webdriver-0.6.7 is latest gem and doesn't have it. Thanks indeed.

@jarib
Copy link
Member

jarib commented Feb 20, 2014

I'll push 0.6.8 shortly.

@jarib
Copy link
Member

jarib commented Feb 20, 2014

All done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to locate element using :css and :index :css should work for all container methods, not just #element
4 participants