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

Access to page methods within section #292

Open
brbrr opened this issue May 26, 2015 · 3 comments
Open

Access to page methods within section #292

brbrr opened this issue May 26, 2015 · 3 comments
Labels

Comments

@brbrr
Copy link

brbrr commented May 26, 2015

Now sections are threaded as elements with some other elements in it but this approach makes unable to use page methods inside sections: wait_until { login_button? } will raise NoMethodError: undefined method 'wait_until' for Watir::HTMLElement

From stackoverflow:

In the short term, you could work around the issue by calling wait_until directly against the Watir::Browser, which is returned by the page object's browser method:

browser.wait_until { login_button? }

But I think sections should be treated as PageObjects with all related methods

@imankovskyi
Copy link

Hi. I have run into this issue too. Browser which was used for PageObject initialization is not available in @browser variable ( inside page section class ), but can be accessed with @browser.browser instead.
So @browser inside PageSection is actually an instance of Watir::HTMLElement. This seems like a bug that should be fixed.

@titusfortner
Copy link
Contributor

Do you have code to reproduce this?

@imankovskyi
Copy link

Yes. I have created minimal example that reproduces it:

page_section.zip

 $ rspec spec/test_spec.rb 
page.ddg_header.browser is: #<Watir::HTMLElement: located: false; {:id=>"header_wrapper"}>
page.ddg_header.browser.browser is: #<Watir::Browser:0x..f958b67bbcb8d8eae url="https://duckduckgo.com/?q=search&ia=web" title="search at DuckDuckGo">
page.ddg_header.browser.browser.browser is: #<Watir::Browser:0x..f958b67bbcb8d8eae url="https://duckduckgo.com/?q=search&ia=web" title="search at DuckDuckGo">
.

@jkotests jkotests added the bug label Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants