-=UPDATE=-
The problem I was experiencing was a case where the certificate was valid, but the site was invalid for the certificate. Leaving the default settings (either providing a profile with the certificate default settings or using the standard :selenium driver in Capybara) worked for my case. I mistakingly thought I needed to modify my Firefox profile for the driver to work, this wasn't the case.
Removing the certificate settings from my custom profile fixed the issue. Thanks Jarib.
-=Original Question=-
I'm currently trying to setup my test browsers to ignore invalid SSL certificates when using Cucumber and Capybara. I have the following in my env.rb:
Capybara.register_driver :selenium_profile do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile.secure_ssl = false
profile.assume_untrusted_certificate_issuer = false
Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
end
Capybara.configure do |config|
config.run_server = false
config.default_driver = :selenium_profile
config.default_wait_time = 15
end
The environment seems to be setup properly, and the testcase runs fine until I hit an invalid certificate.
Is there something I'm doing wrong in the code above? Is there another option (using script/code) to create a new profile that ignores certificates? I'm trying to do some black box testing on a qa site, so self signed certificates aren't really an option. Individual Firefox profiles aren't good since the code needs to be portable. Thoughts?
Environment:
OS X.7.3
Firefox 12.0
ruby-1.9.2
capybara (1.1.2 ruby, 0.4.1.2)
capybara-webkit (0.8.0)
cucumber (1.1.9)
selenium-webdriver (2.21.2)
Did you try without profile.assume_untrusted_certificate_issuer = false
and with profile.accept_untrusted_certs = True
Related
I have UI application which for which I had build Test Automation Framework using Selenium Python Pytest Framework. When I launch web application, a pop window appears where I have to select valid PKI Test Certificate, after which only the application opens up. As this authentication pop-up is windows based and cannot be authenticated using selenium webdriver, can someone suggest any solution by which I can pass the .p12 certificate and password and the application can be accessed. I tried to use service_args in phantom js, which works very well.
def phantomJsDriver():
headlessDriver = webdriver.PhantomJS(executable_path='../drivers/phantomjs.exe', service_args=['--ignore-ssl-errors=true', '--ssl-client-certificate-file=<path of .pem file>', '--ssl-client-key-file=<path of key file>', '--ssl-client-key-passphrase=<passphrase>'])
headlessDriver.set_window_size(1280, 1024)
return headlessDriver
But same thing is not working in case of chrome or edge chromium. Can someone please provide any solution for this?
When deploying a Corda 4.0 CorDapp to UAT, must the Jar be signed?
We have tried using devMode = true - which causes the node to recognize the flows in the CorDapp, but when we set devMode to false it seems the node is unable to recognize the CorDapp.
This could be because the JAR has been signed using the default development key. This is the case when devMode is set to true in your build.gradle.
If this is the case you need to add cordappSignerKeyFingerprintBlacklist=[] to the node.conf. If devMode=false, the Corda development key is blacklisted as it's completely insecure. This is suitable for PoC purposes only, NOT PRODUCTION.
The correct fix is to sign the app with a your 'own' key.
You can also switch off Jar signing when building the CorDapp by setting cordapp { signing { enabled false } } in the build.gradle, which should cause it not to be signed.
More information can be found here: https://docs.corda.net/cordapp-build-systems.html#signing-the-cordapp-jar
I am a newbie to Capybara.
Here is my configuration within file env.rb
Capybara.configure do |config|
config.run_server = false
#config.default_driver = :selenium
config.default_driver = :rack_test
config.app_host = 'point to my localhost port 3000'
end
Everything runs just fine if I set default_driver to :selenium. But I need to set the driver to :rack_test, so that when running cucumber command, it will not open the web browser.
Many thanks,
P/S If you are an expert, please show me the learning path, I'm not expecting someone showing them selves.
I presume you want to test against a test server controlled by capybara (which is the normal way to do it), rather than testing against your dev instance (the one at localhost:3000) or a staging server or something.
First, configure capybara to run your Rails app. The usual way to do this is to add the cucumber-rails gem to your Gemfile and require 'cucumber/rails' in your env.rb. You can also set up capybara to run Rails (or any Rack app) manually.
Having done that, capybara will do what you want (use the Rack::Test driver) by default. Remove the configuration that you showed from your env.rb and Cucumber/capybara will work the way you want.
If you also want some scenarios to use Javascript, tag those scenarios with #javascript and add
Capybara.javascript_driver = :selenium
to your env.rb. Capybara will continue to use its Rack::Test driver for scenarios without the tag, and will use its Selenium driver for scenarios with the tag.
Thank you Dave for helping me during the time. Briefly, in order for running "cucumber" without triggering to open a web-browser (which is rack-test), here is the configuration:
1> File env.rb.
require 'cucumber/rails'
Only 1 line above is enough.
2> File .feature
Feature: Post a new Product
Feature: Post a new Product
Scenario: Open new product page
Given I open new product site
When I input new product
Then I should see the product created confirmed
By the way, we don't need "Capybara.javascript_driver = :selenium" within file env.rb.
There's still so many tricky things I need to learn about capybara and cucumber
I want to deploy a ravendb server in production.
I don't want it to be accessible by anyone, so Raven/AnonymousAccess is set to None
I want to use OAuth as authentication, but how can I now setup a new ApiKey?
I want this to be automated, so "install raven with AnonymousAccess = Admin, create apikeys manually, set AnonymousAccess to None manually" is not an option.
Is there a way in which I can either
Create a new ApiKey even though AnonymousAccess is set to None
or
Create an ApiKey automatically and then change AnonymousAccess to None automatically
(and by automatically I mean: in code)
Thanks!
You can do that by authenticating using Windows Auth then setting up the API keys.
I still haven't found a way to do this properly.
The way I'm currently handling it is:
Deploy with Raven/AnonymousAccess set to Admin
Set the ApiKeys manually
Redeploy with Raven/AnonymousAccess set to None
Not the best way, but at the moment, I can't find a better way.
I run a web with CherryPy (version 3.2.0) and use cherrypy.session to store session specific data. It works perfectly with Firefox. However, I noticed that cherrypy.session would run in problems on Chrome. Basically, it looks like session variable resets when the consequent pages are being browsed.
I believe my config is set correctly
tools.sessions.on = True
tools.sessions.storage_type = "ram"
tools.sessions.storage_path = "/home/dmitry/test/sessions"
tools.sessions.timeout = 60
tools.sessions.name = "test"
What can lead to such a browser-specific problem?
I guess by now you've figured out the solution, but one possible cause can be that the development server is running on localhost, and chrome refuses to set cookies. You have to set up exceptions to make it work. Searching Google for this issue brings up some promising results.