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

Body#link relates to an HTML attribute rather than a tag #12

Closed
abotalov opened this issue Aug 13, 2018 · 8 comments
Closed

Body#link relates to an HTML attribute rather than a tag #12

abotalov opened this issue Aug 13, 2018 · 8 comments

Comments

@abotalov
Copy link

abotalov commented Aug 13, 2018

Meta -

Nerodia Version: 0.9.0

Expected Behavior -

Invoking methods on body works just as with other elements.

Actual Behavior -

Invoking methods on body doesn't work. It fails with TypeError: 'str' object is not callable

Steps to reproduce -

from nerodia import browser
br = browser.Browser()
br.goto("http://example.com")
br.body().link(text="More information...").click()
@lmtierney
Copy link
Collaborator

After looking into this, body() is working fine. The link call is returning a string because link is a valid attribute for body. So it is returning the attribute before looking for an a within the body. Is there a reason you're getting body first?

@lmtierney
Copy link
Collaborator

This is currently the same behavior as Watir so I'll have to talk with them to see how to proceed

@abotalov
Copy link
Author

abotalov commented Aug 13, 2018

There's no good reason, actually. I was only experimenting. Found it strange that it doesn't work.

@lmtierney
Copy link
Collaborator

To explain it better... Each element has a set of valid attributes, which are listed in https://github.com/watir/watir/blob/master/lib/watir/elements/html_elements.rb

Basically, since link is a valid attribute for body, it just returns the attribute since it thinks that is what you want.

@lmtierney lmtierney self-assigned this Aug 13, 2018
@titusfortner
Copy link
Member

Yeah, Watir needs to add it to this method: https://github.com/watir/watir/blob/master/lib/watir/generator/html/generator.rb#L18-L20

@abotalov abotalov changed the title Invoking methods on body() doesn't work Body#link relates to an HTML attribute rather than a tag Aug 27, 2018
@titusfortner
Copy link
Member

This will fix it: watir/watir@fecf8cb
As soon as we do: watir/watir#705

@titusfortner
Copy link
Member

@lmtierney the code has been updated in Watir

@lmtierney
Copy link
Collaborator

This should now be fixed via 4bdca07 released in0.11.0

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

No branches or pull requests

3 participants