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

implement keyword support #520

Merged
merged 1 commit into from Jan 9, 2017
Merged

Conversation

titusfortner
Copy link
Member

Being able to set a keyword value for an element is especially useful for page object implementations. Rather than trying to match the selector output to a defined method, the user can now just look up the name of the element assigned. It would need to be implemented in the Page Object gems, but this provides the necessary hook for that.

Also, I changed the error messages to use #selector_string when really they should be using #inspect like was there before. #selector_string is still recursive, but #inspect includes information about "located", "class name" and the new "keyword." (I removed the memory information; that is still available with Element#to_sif anyone cares about it).

@@ -49,10 +51,13 @@ def exists?
alias_method :exist?, :exists?

def inspect
string = "#{self.class}: "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it look like a usual Ruby inspect which wraps class in #<Class>:

string = "#<#{self.class}: "
# ...
string << '>'

it "displays selector string for regular element" do
browser.goto(WatirSpec.url_for("wait.html"))
describe "#inspect" do
before(:each) { browser.goto(WatirSpec.url_for("nested_iframes.html")) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add empty line below

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.

None yet

2 participants