Edge browser support - watir-webdriver

Any idea if we have an official support for Edge browser using watir-webdriver api? I am able to launch Edge browser with a sample script, but I am not able to interact with elements. I tried the following code and it's failing to set the text field.
require 'watir-webdriver'
$browser = Watir::Browser.new 'edge'
$browser.goto('http://www.google.com')
$browser.text_field(:name => 'q').set "hello"
Error:
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/response.rb:73:in `assert_ok': status code 501
(Selenium::WebDriver::Error::ServerError)
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/response.rb:34:in `initialize'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:78:in `new'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:78:in `create_response'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/default.rb:90:in `request'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:664:in `raw_execute'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:642:in `execute'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/remote/bridge.rb:229:in `switchToDefaultContent'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.48.1/lib/selenium/webdriver/common/target_locator.rb:100:in `default_content'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/browser.rb:346:in `assert_exists'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:561:in `ensure_context'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:545:in `locate'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/elements/element.rb:505:in `assert_exists'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/user_editable.rb:32:in `clear'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/watir-webdriver-0.9.1/lib/watir-webdriver/user_editable.rb:11:in `set'
from test.rb:6:in `<main>'

In Selenium 2.48, there is an issue using the Ruby bindings (which Watir does) with Edge via the remote server. This issue has been fixed, but won't be available until Selenium 2.49 is released.
It is also worth noting that Microsoft WebDriver for Edge is still a little buggy, so you would likely be getting various other errors if you were not getting the error you are currently getting. :)

Related

How to use custom dev-tool for Brave Browser?

I'm debugging wasm code in dev-tool, there is a line limit for displaying the wasm source code, which is 1000*1000 lines by default, when exceeds the limit, it shows ";; .... text is truncated due to the size":
My wasm is larger than that, so I'm trying to build my custom dev-tools. My environment is Kali Linux + Brave Browser.
According to this article, I commented out the lines:
And built successfully, the only difference is that the output directory in the article is ".../resources/inspector" and mine is ".../resources/inspector_overlay".
I tried launch it with --custom-devtools-frontend=file:///root/.../inspector_overlay, when press F12, the dev-tool fails to open, it shows error:
[82506:82549:0121/223355.672780:ERROR:devtools_ui_data_source.cc(306)] Failed to read /root/Downloads/devtools-frontend/out/Default/resources/inspector_overlay/devtools_app.html
[82506:82506:0121/223355.693282:ERROR:CONSOLE(67)] "Uncaught TypeError: Cannot read properties of undefined (reading 'setInspectedTabId')", source: devtools://devtools/bundled/devtools_compatibility.js (67)
How to make it work?
I found from this discuss that the correct path should be gen/front_end, so the param is: --custom-devtools-frontend=file:///root/Downloads/devtools-frontend/out/Default/gen/front_end

Could not find rake-12.3.0 in any of the sources (Bundler::GemNotFound) - Bitnami Redmine Stack 3.3.1-0 on Ubuntu 16.04.2 LTS

I am using the Bitnami Redmine Stack 3.3.1-0 on Ubuntu 16.04.2 LTS.
I recently installed a plugin (Issue Templates - http://www.redmine.org/plugins/redmine_issue_templates).
In the process, I updated the gems using bundle install and bundle update.
After performing this update, the Redmine website no longer works. I get the error:
"We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."
Upon analyzing the apache error log, I find the error:
"Could not find rake-12.3.0 in any of the sources (Bundler::GemNotFound)"
However, I have checked /opt/bitnami/apps/redmine/htdocs/vendor/ and /opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems and rake-12.3.0 is included in both locations. I am not sure why this issue is occuring.
I uninstalled the plugin and removed the files, but I still have the issue. I tried bundle install, bundle update, gem install rake -v '12.3.0', bundle exec rake rails:update:bin in the /opt/bitnami/apps/redmine/htdocs/ folder, and I also tried ./gem update in the /opt/bitnami/ruby/bin folder, but I still have the issue.
Please advise me what to do.
[ 2018-03-15 15:35:23.8349 28957/7f4ce96ec700 age/Hel/Req/CheckoutSession.cpp:252 ]: [Client 4-1] Cannot checkout session because a spawning error occurred. The identifier of the error is 35671c4a. Please see earlier logs for details about the error.
App 4445 stdout:
App 4445 stderr: /opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/lib/phusion_passenger/config/system_metrics_command.rb:34: warning: Insecure world writable dir /opt/bitnami/ruby/bin in PATH, mode 040757
App 4445 stdout:
[ 2018-03-15 15:35:29.9175 28957/7f4ce86a9700 App/Implementation.cpp:287 ]: Could not spawn process for application /opt/bitnami/apps/redmine/htdocs/: An error occured while starting up the preloader.
Error ID: 16a39427
Error details saved to: /tmp/passenger-error.3ZEVOb
Message from application: <p>It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:</p>
<pre class="commands">bundle install</pre>
<p>If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:</p>
<ol>
<li>Is this app supposed to be run as the <code>daemon</code> user?</li>
<li>Is this app being run on the correct Ruby interpreter? Below you will
see which Ruby interpreter Phusion Passenger attempted to use.</li>
</ol>
<p>-------- The exception is as follows: -------</p>
Could not find rake-12.3.0 in any of the sources (Bundler::GemNotFound)
<pre> /opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:88:in `block in materialize'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `map!'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/spec_set.rb:82:in `materialize'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/bundler-1.16.1/lib/bundler/setup.rb:20:in `<top (required)>'
/opt/bitnami/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
/opt/bitnami/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/opt/bitnami/ruby/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/lib/phusion_passenger/loader_shared_helpers.rb:278:in `block in run_load_path_setup_code'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/lib/phusion_passenger/loader_shared_helpers.rb:381:in `running_bundler'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/lib/phusion_passenger/loader_shared_helpers.rb:276:in `run_load_path_setup_code'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/helper-scripts/rack-preloader.rb:99:in `preload_app'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/helper-scripts/rack-preloader.rb:157:in `<module:App>'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/opt/bitnami/ruby/lib/ruby/gems/2.1.0/gems/passenger-5.0.6/helper-scripts/rack-preloader.rb:28:in `<main>'</pre>
[ 2018-03-15 15:35:29.9342 28957/7f4ceaeef700 age/Hel/Req/CheckoutSession.cpp:252 ]: [Client 1-2] Cannot checkout session because a spawning error occurred. The identifier of the error is 16a39427. Please see earlier logs for details about the error.
Did you load the Bitnami environment before running the "bundle" commands? There's a script at /opt/bitnami/ called "use_redmine". Please run it before running the commands.
For instance:
/opt/bitnami/use_redmine
cd /opt/bitnami/apps/redmine/htdocs/
bundle ...
Note: if you installed the Redmine Stack as superuser "root" on your Ubuntu, you need to load the environment using sudo /opt/bitnami/use_redmine

CSRF detected using OmniAuth-facebook, warden_ominiauth, warden run in cygwin

I been facing this problem recently. I receive this error in my browser.
In my cygwin it keep redirect me and end up showing
ERROR -- omniauth: (facebook) Authentication failure! csrf_detected:
OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected
E, [2015-04-16T11:21:15.660929 #10056] ERROR -- omniauth: (facebook)
Authentication failure! invalid_credentials:
OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detecte
I tried various method suggested but failed to solve my problem.
method 1
method 2
After some testing, I think is my configuration problem but still have no idea how to fix it. It seem WardenOmniAuth could not receive the callback from facebook which keep looping and redirecting until the time spam killed it.
Here is my coding in my app.rb
failure = lambda{|e| Rack::Resposne.new("Can't login", 401).finish }
use Rack::Session::Cookie
use Warden::Manager do |config|
config.failure_app = failure
config.default_strategies :omni_facebook
end
use OmniAuth::Strategies::Facebook, ENV["APP_ID"], ENV["APP_SECRET"]
use WardenOmniAuth do |config|
config.redirect_after_callback = "/home"
end
I found the solution. It seem that the Warden_OmniAuth gem have bug. It goes haywire when reach the callback point and cause a repeating loop of calling the callback.
So I change to using Warden gem, OmniAuth gem and OmniAuth-facebook gem. By using a builder and the warden strategie.

Unable to find the socket transport "ssl"

I'm trying to figure out "why" I'm getting an error message from the Joomla 3.X component Gcalendar (google calendar). The error message is below.
Error Unable to Connect to ssl://www.google.com:443. Error
#-912967449: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
I have read several other threads on here and other sites but most outline 'how' to enable/install/etc... SSL. I've copied/pasted the info.php data into a google doc here. Everything dealing with SSL is labeled as 'on' or 'installed.
The server is not 'public' right now, it is only available from within the school district's network. Could this be the reason for the problem?
Any ideas anyone?
ssl://www.google.com:443
should be
https://www.google.com:443
I just had this error as well. In my case it was because I was working locally, not on the live site. Once I put it live, it worked fine. Just putting this here in case anyone else comes across the same thing.
Install OpenSSL module for php:
1. In the php.ini file,
add this line "extension = php_openssl.dll"
2.Make sure that the folder "ext" have this dll,
if not then add the desired version.
Установить для php модуль OpenSSL:
1)В файле php.ини,
добавь строку "extension=php_openssl.dll"
2) Убедись что в папке "ext" есть эта dll,
если нет то добавте необходимой версии.

Sinatra App on Heroku ActiveRecord::StatementInvalid: PGError: ERROR:

SCENARIO:
I currently have anapplication on Heroku that is Sinatra Application + ActiveRecord. What currently works:
• I am able to view static pages of my site
• I am able to run migrations
• I am able to push my local development db to my Heroku DB (heroku db:push postgres://localhost/dev)
• I am able to pull from the Heroku DB down to my localhost DB (heroku db:pull postgres://localhost/dev)
THE ERROR:
When I navigate to a page that makes a simple query like:
#pics = Picture.find(:all)
I get this error in my log file
DEBUG -- : NoMethodError: undefined method `values' for #<PGresult:0x00000002844098>: SHOW client_min_messages
DEBUG -- : PGError: ERROR: invalid value for parameter "client_min_messages": ""
: SET client_min_messages TO ''
ActiveRecord::StatementInvalid - PGError: ERROR: invalid value for parameter "client_min_messages": ""
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `async_exec'
At this point I'm not sure what is wrong so I decided to log onto the heroku console and run this command to see if my tables are in the DB
> heroku console
> ActiveRecord::Base.connection.tables
AND I get a similar errors
ActiveRecord::StatementInvalid: PGError: ERROR: invalid value for parameter "client_min_messages": ""
: SET client_min_messages TO ''
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `async_exec'
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `block in execute'
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract_adapter.rb:244:in `block in log'
/app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
Then I decided to try this in the console...
> ActiveRecord::Base.establish_connection
> ActiveRecord::AdapterNotSpecified: ActiveRecord::AdapterNotSpecified
/app/.bundle/gems/ruby/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:54:in `establish_connection'
/home/heroku_rack/lib/console.rb:158:in `block (2 levels) in <top (required)>'
/home/heroku_rack/lib/console.rb:148:in `eval'
/home/heroku_rack/lib/console.rb:148:in `_eval'
At this point it would seem that I have no tables and adapter connection but how can that be when I'm able to run migrations and push and pull from the Heroku DB?
UPDATE 1 - NOT MUCH FURTHER ALONG BUT MORE INSIGHT
So I decided to start from scratch and do this over again. I seem to have made some progress but I'm stuck. At re-ran my scenario I mentioned above and succeed. So my database, migration and data are all in the DB. But my app still cannot connect to the DB. BUT what's weird is my console interaction.
> heroku console
> ActiveRecord::Base.connection_config
> {:adapter=>"postgresql", :database=>"1e2e12e21e", :username=>"1e2e12e21e", :password=>"i2j3i23joo12", :host=>"1e2-12e-2e1212-e2e2e1.compute-1.amazonaws.com", :port=>5432, :encoding=>"unicode"}
NOTE: I replaced the real details with this fake stuff just to illustrate
> ActiveRecord::Base.connection_handler
> #<ActiveRecord::ConnectionAdapters::ConnectionHandler:0x00000002f8a578 #connection_pools={"….
NOTE: This a really long string but it has content
> ActiveRecord::Base.connected?
> false
At this point I really don't get it? I don't get how I can keep running db migrations, keeping push and pulling data, log into Heroku Console see my connection_config details, BUT when I run my app internal server error. AND when I run ActiveRecord::Base.connection.tables in heroku console I get ActiveRecord::StatementInvalid: PGError: ERROR: invalid value for parameter "client_min_messages": ""
Any thoughts on what I could be doing wrong?
FINAL UPDATE
Here is what the problem is:
Heroku support kindly pointed to me to a known issue with activerecord 3.1.3. It's a bug that should be fixed in future updates: https://github.com/rails/rails/commit/92a3c487bb0d125c437e53a7f45c31fcca97f2d9
How to solve the problem:
I decided to use a much lower version of activerecord in my gemfile gem "activerecord", "~> 3.0.9 and my site is up and running with no problems so far.
Why I never tried this out before I don't know. I hope this post anyone else.
I had this problem for a long time and it was driving me nuts. I couldn't find a solution anywhere (and many rails updates passed by not solving the "problem"), so i decided to just hunt down the issue myself. It turned out to be an easy fix. Just add an additional key, value pair: :min_messages => "warn" (or whatever message level you want) to the ActiveRecord setup in your configure block. here's what I'm using in my Sinatra app's right now, using Sinatra 1.3.2 and ActiveRecord 3.2.2:
db = URI.parse(ENV['DATABASE_URL'] || "postgres://user:password#localhost/database")
adapter = (db.scheme == "postres") ? "postgresql" : db.scheme
ActiveRecord::Base.configurations[:production] = {
:adapter => adapter,
:username => db.user,
:password => db.password,
:port => db.port,
:database => db.path.sub(%r(^/),""),
:host => db.host,
:min_messages => "warn"
}
unless ActiveRecord::Base.connected?
ActiveRecord::Base.establish_connection ActiveRecord::Base.configurations[:production]
ActiveRecord::Base.logger = Logger.new(STDOUT)
end
hope this helps you and any other people having these issues!
None of the other suggestions worked for me. I ultimately fixed this by switching to the Heroku cedar stack:
heroku create your app --stack cedar
I had this problem on both bamboo-ree-1.8.7 and bamboo-mri-1.9.2 stacks. The application worked fine on localhost, and migrated OK on heroku, but reading the database inside the heroku web stack failed with a client_min_messages complaint.
Setting the :min_messages (as suggested in another answer) to either "warn" or "warning" produced different errors.
Forcing my ActiveRecord down to 3.0.11 (from 3.2.3) resolved the issue. (Not that I see anything in AR to explain this. I speculate it's related to differing postgres versions ... I'm using 9.0.3, suspect the heroku bamboo shared is 8.4)
Pushing this up in my gem file worked for me.
group :production do
gem 'pg'
gem 'activerecord', '~> 3.0.9'
end