Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

can't find element with webkit #984

Closed
majioa opened this issue Feb 26, 2017 · 12 comments
Closed

can't find element with webkit #984

majioa opened this issue Feb 26, 2017 · 12 comments

Comments

@majioa
Copy link

majioa commented Feb 26, 2017

Note: This is for issues with Capybara. If you have a howto type question, please ask on the mailing list as requested in the README: http://groups.google.com/group/ruby-capybara

Meta

Capybara Version:

2.7.0
Driver Information (and browser if relevant):

capybara-webkit 1.11.1
qt 5.6.2
qt5-webkit-common-5.6.2-alt0.M80P.1

Expected Behavior

fill_in('email', with: @user.email) finds the input element

Actual Behavior

Capybara::ElementNotFound

Steps to reproduce

the code:

        <div class="input-wrap">
           <input aria-required="true" autofocus="autofocus" class=" b-input b-input__m_text required" data-email-healing="true" id="user_email" name="email" placeholder="Email" size="30" spellcheck="false" tabindex="1" type="email">
        </div>
@BroiSatse
Copy link

@majioa - When filling the field, you need to either use the label text (assuming you have the label with correct for attribute) or the id of the field. Your field has id user_email so you should do:

fill_in(:user_email, with: @user.email)

@twalpole
Copy link
Collaborator

twalpole commented Mar 1, 2017

@BroiSatse Actually it matches on either the label text, the id or the name attribute of the field (or the placeholder attribute - non-documented) - http://www.rubydoc.info/gems/capybara/Capybara/Node/Actions#fill_in-instance_method

Judging by the classes and data attribute on the HTML element shown I'm guessing it's actually being replaced by a JS widget on the page, and so the actual element is hidden. You'd need to interact with the actual elements that are visible on the page.

@majioa
Copy link
Author

majioa commented Mar 2, 2017

@twalpole in my browsec the input fields of the form are visible...

@majioa
Copy link
Author

majioa commented Mar 2, 2017

I've found out the problem, and it seems there is a some issue with webkit since it does not properly parses the .scss files. We have the following code in styles scss:

@import 'modern/blocks/**/*.scss';

But it wont work when webkit parses and processes the page, however it works in regular browser, when I replaced it with the explicit form, the lost element becomes found.

@import 'modern/blocks/header/switchLang.css.scss';

Additionally, there is the problem with recursive importing, when I put the following line into a .scss file, which in its order is imported in the top level .scss, for example from switchLang.css.scss in the example above:

@import 'base/_base64.css.scss';

So that is it.

@twalpole
Copy link
Collaborator

twalpole commented Mar 2, 2017

@majioa No "browser" processes scss files, they first have to be processed by whatever asset pipeline you're using into normal css which a browser can then parse. If you're having issues with scss files not being included/parsed that's an issue with your asset pipeline in the test environment and not capybara-webkit.

@majioa
Copy link
Author

majioa commented Mar 3, 2017

ok, but that is the difference in proceedings of the scss's, in regular case (in rails), and in capybara ecosystem?

@jferris
Copy link
Member

jferris commented Mar 3, 2017

Would it be possible to put together a small example that reproduces the issue you're seeing? It's hard for me to understand how Capybara or WebKit could be involved here, because they both read compiled CSS files and not SCSS.

@ademars94
Copy link

@majioa We were getting some ElementNotFound errors recently, and found that updating to QT 5.5, along with rebuilding capybara-webkit, solved the issue. Have you tried this?

https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

@majioa
Copy link
Author

majioa commented Mar 8, 2017

@ademars94 I have qt 5.6.2

@majioa
Copy link
Author

majioa commented Mar 8, 2017

@jferris for example there is a top level *.scss called styles.css.scss, which is included in application.css as follows:

 *= require styles

try import from the styles.css.scss files not one-by-one, but by a mask,:

 @import 'modern/blocks/**/*.scss';

instead of:

 @import 'modern/blocks/header/switchLang.css.scss';

Then I receive faults in parsing.

@dezmathio
Copy link

FYI @majioa -> from their https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

Qt 5.5 is the last version of Qt that capybara-webkit will support. The Qt project has dropped the WebKit bindings from binary releases in 5.6.

@twalpole
Copy link
Collaborator

Closing due to lack of way to replicate - if one is provided we can reopen

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

No branches or pull requests

6 participants