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

"Received 0" using webkit but not selenium #674

Closed
stinju opened this issue Oct 19, 2014 · 8 comments
Closed

"Received 0" using webkit but not selenium #674

stinju opened this issue Oct 19, 2014 · 8 comments

Comments

@stinju
Copy link

stinju commented Oct 19, 2014

Getting "Received 0" for an external url, and I'm not sure how to further debug. Test runs fine using selenium (firefox) driver.

This may or may not have to do with upgrading to Yosemite. I know this test used to work on this machine sometime in the past, but I've only recently re-run this test on this machine *after upgrading to Yosemite. Not very useful info since I didn't run the test just before upgrading the OS, but I figured I'd mention it.

Also important to note is that this test runs fine using webkit on two other machines not upgraded to Yosemite, but with same versions of qt/capybara-webkit/capybara. So, I'm not very confident that this is an issue with capybara-webkit itself, but definitely looking for some debugging tips or insight. Anything would be greatly appreciated. Thanks in advance!

webkit_debug log snippet:

Load started 
Started request to "https://sandbox.braintreegateway.com/merchants/xxx/transparent_redirect_requests" 
Received 0 from "https://sandbox.braintreegateway.com/merchants/xxx/transparent_redirect_requests" 
Page finished with false 
Load finished 
Started request to "https://maps.gstatic.com/cat_js/maps-api-v3/api/js/18/9/%7Bcommon,util,stats%7D.js" 
Received 200 from "https://maps.gstatic.com/cat_js/maps-api-v3/api/js/18/9/{common,util,stats}.js" 
Started request to "https://maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate...
Received 200 from "https://maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate...
Received "FindCss(.ui-page-active.xxx)" 
Wrote response false "{"class":"InvalidResponseError","message":"Unable to load URL: http://127.0.0.1:7787/xxx because of error loading https://sandbox.braintreegateway.com/merchants/xxx/transparent_redirect_requests: Unknown error"}" 

Versions:

qt: stable 4.8.6
capybara-webkit (1.3.0)
capybara (2.4.4)
@mhoran
Copy link
Collaborator

mhoran commented Oct 19, 2014

This could be an issue with Qt and the OS X CA trust chain. Could you try setting page.driver.browser.ignore_ssl_errors?

@stinju
Copy link
Author

stinju commented Oct 19, 2014

Very nice, you nailed it. Test passes with ignore_ssl_errors. Can't say I completely understand the interactions between qt and the CA trust chain - is this something that is addressable without ignore_ssl_errors? Or, is there something that I can do to verify exactly what the issue/error is? I'm mostly happy with just being able to get the test green again, but want to do diligence here. Thanks again for your (very prompt) help!

@mhoran
Copy link
Collaborator

mhoran commented Oct 19, 2014

I've been contemplating shipping a CA chain along with capybara-webkit. However, that would mean we'd be forcing our users to trust the chain that we bundle. Ideally the system trust chain would just work, but it seems that on some systems, it doesn't. I've actually seen this on my machine, which is how I knew about it. It seems to come and go, depending on what library version I'm using and the phase of the moon.

I'll give it some more thought and let you know what we come up with. In the meantime, ignoring SSL errors should work. I'd also imagine that the official Qt binaries don't have this problem, so it could be a problem with (assuming you're using Homebrew) whatever got installed via brew install qt. You may want to try brew install qt5 and set the QMAKE environment variable to the qmake binary installed in /usr/local/opt. There are some subtle differences between Qt 4 and 5 that may cause test failures, but the Qt 5 packages are official binaries and may better support Yosemite.

@stinju
Copy link
Author

stinju commented Oct 20, 2014

FYI qt5 seemed to give the same failure (but with some additional warnings), so I'm back to qt(4). Will continue to track here for updates, but feel free to close as you see fit. Thanks again!

@avsh
Copy link

avsh commented Feb 26, 2015

I've got the same error. In my case it is Yosemite and the SSL host pangalink.net.
The host uses cloudfare and their SNI shared SSL certificate.

Here is my pry session log

[12] pry(#<Cucumber::Rails::World>)> page.driver.browser.ignore_ssl_errors
=> ""
[13] pry(#<Cucumber::Rails::World>)> page.driver.browser.enable_logging
Finished "EnableLogging()" with response "Success()"
Wrote response true ""
=> ""
[15] pry(#<Cucumber::Rails::World>)> page.visit 'https://www.pangalink.net/'
Received "Visit(https://www.pangalink.net/)"
Started "Visit(https://www.pangalink.net/)"
Load started
"Visit(https://www.pangalink.net/)" started page load
Request to unknown URL: https://www.pangalink.net/
To block requests to unknown URLs:
  page.driver.block_unknown_urls
To allow just this URL:
  page.driver.allow_url("https://www.pangalink.net/")
To allow requests to URLs from this host:
  page.driver.allow_url("www.pangalink.net")
Started request to "https://www.pangalink.net/"
Finished "Visit(https://www.pangalink.net/)" with response "Success()"
Received 0 from "https://www.pangalink.net/"
Page finished with false
Load finished
Page load from command finished
Wrote response false "{"class":"InvalidResponseError","message":"Unable to load URL: https://www.pangalink.net/ because of error loading https://www.pangalink.net/: Unknown error"}"
Capybara::Webkit::InvalidResponseError: Unable to load URL: https://www.pangalink.net/ because of error loading https://www.pangalink.net/: Unknown error
from /Users/avs/.rvm/gems/ruby-2.1.2/gems/capybara-webkit-1.4.1/lib/capybara/webkit/browser.rb:289:in `check'

@aripollak
Copy link

qt5 5.5 just landed in Homebrew and uses Secure Transport instead of OpenSSL, which fixes this problem!

@avsh
Copy link

avsh commented Jul 23, 2015

Thank you. I will try to update qt5

@jferris
Copy link
Contributor

jferris commented Jul 27, 2015

I'm going to close this, as it appears to be resolved by Qt 5.5. Fell free to comment if you're still having trouble.

@jferris jferris closed this as completed Jul 27, 2015
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

5 participants