closing browser error - change behavior - watir

I'm experiencing some strange behavior with Watir when I want to close the browser.
brs = Watir::Browser.new
=> #<Watir::Browser:0x1035fc1f8 url="about:blank" title="">
brs.close
=> true
brs
NoMethodError: undefined method `closed?' for nil:NilClass
The browser is closed properly (as expected) but after that I'm unable to operate with the class / instance.
Why is that happening?

I am not getting the error message:
$ irb
1.9.3-p125 :001 > require "watir-webdriver"
=> true
1.9.3-p125 :002 > b = Watir::Browser.new
=> #<Watir::Browser:0x7e1df9f913a40838 url="about:blank" title="">
1.9.3-p125 :003 > b.close
=> true
1.9.3-p125 :004 > b
=> #<Watir::Browser:0x7e1df9f913a40838 closed=true>
Environment:
- Mac OS X 10.7.3
- Firefox 12.0
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
$ gem -v
1.8.23
$ gem list *webdriver
...
selenium-webdriver (2.21.2)
watir-webdriver (0.5.5)
...

Related

undefined symbol: __atomic_exchange_8

I'm trying to run google assistant on my raspberry pi following the steps on: https://developers.google.com/assistant/sdk/guides/service/python/embed/run-sample
all works fine until activating the Google Assistant with the command:
googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model
I'm getting the following ImportError:
Traceback (most recent call last):
File "/home/pi/env/bin/googlesamples-assistant-pushtotalk", line 5, in <module>
from googlesamples.assistant.grpc.pushtotalk import main
File "/home/pi/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 28, in <module>
import grpc
File "/home/pi/env/lib/python3.9/site-packages/grpc/__init__.py", line 22, in <module>
from grpc import _compression
File "/home/pi/env/lib/python3.9/site-packages/grpc/_compression.py", line 15, in <module>
from grpc._cython import cygrpc
ImportError: /home/pi/env/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-arm-linux-gnueabihf.so: undefined symbol: __atomic_exchange_8
Any ideas on how to fix this?
just ended up here since I ran into the same problem (on a different project) but also involving python3.9, cygrpc on a RPi4 with a recent raspbian-lite (32bit).
While I don't have a solution here are my guesses:
formerly __atomic_exchange_8 was defined in /lib/arm-linux-gnueabihf/libgcc_s.so.1 but now it seems defined in libatomic:
$ grep __atomic_exchange_8 /lib/arm-linux-gnueabihf/libatomic.so.1
grep: /lib/arm-linux-gnueabihf/libatomic.so.1: binary file matches
EDIT:
Solved it. I was looking at the patch which tried to solve the problem two years ago:
https://github.com/grpc/grpc/pull/20514/commits/b912fc7d8d401bb65b3147ee77d03beaa3d46038
I figured their test check_linker_need_libatomic() might be broken, and patched it again to always return True, the problem got fixed.
Had tried earlier to fix it by adding CFLAGS='-latomic' CPPFLAGS='-latomic' but that didn't help.
here's my tiny workaround (not fix!) for today's grpc git HEAD:
root#mypi:/home/pi/CODE/grpc# git diff
diff --git a/setup.py b/setup.py
index 1a72c5c668..60b7705cd2 100644
--- a/setup.py
+++ b/setup.py
## -197,6 +197,7 ## ENABLE_DOCUMENTATION_BUILD = _env_bool_value(
def check_linker_need_libatomic():
"""Test if linker on system needs libatomic."""
+ return True
code_test = (b'#include <atomic>\n' +
b'int main() { return std::atomic<int64_t>{}; }')
cxx = os.environ.get('CXX', 'c++')
diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py
index 6b842f56b9..8d5f581ac7 100644
--- a/tools/distrib/python/grpcio_tools/setup.py
+++ b/tools/distrib/python/grpcio_tools/setup.py
## -85,6 +85,7 ## BUILD_WITH_STATIC_LIBSTDCXX = _env_bool_value(
def check_linker_need_libatomic():
"""Test if linker on system needs libatomic."""
+ return True
code_test = (b'#include <atomic>\n' +
b'int main() { return std::atomic<int64_t>{}; }')
cxx = os.environ.get('CXX', 'c++')
root#mypi:/home/pi/CODE/grpc#
EDIT:
as a quick test, cygrpc.cpython-39-arm-linux-gnueabihf.so needs to depend on libatomic:
pi#mypi:~/CODE/grpc $ ldd /usr/local/lib/python3.9/dist-packages/grpc/_cython/cygrpc.cpython-39-arm-linux-gnueabihf.so
linux-vdso.so.1 (0xbeef7000)
/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0xb698b000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb695f000)
libatomic.so.1 => /lib/arm-linux-gnueabihf/libatomic.so.1 (0xb6946000)
libstdc++.so.6 => /lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb67be000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb674f000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb65fb000)
/lib/ld-linux-armhf.so.3 (0xb6fcc000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb65ce000)
This works for me on RPI0 + Bullseye + Python3.9:
pip3 uninstall -y grpcio grpcio-tools
sudo apt install -y python3-grpcio python3-grpc-tools
EDIT: Update to gRPC v1.44.0. The issue has been fixed there, see the explanation below in the old answer.
There was a problem with the order of the parameters used by the compiler to compile some test code which result is used to determine whether libatomic needs to be linked or not.
The issue will be fixed with the next release of grpc. If they maintain the same schedule of previous releases it should be v1.44.0 which should come out some time the next month.
In the mean time you can git cherry-pick the proper fix and build grpc yourself

What does "legacy fallback" mean when cabal is building packages?

When using cabal to build a Haskell package, it appears to mark some packages as legacy fallback:
$ cabal build
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
- appar-0.1.8 (lib:appar) (requires build)
- auto-update-0.1.6 (lib) (requires build)
- base-compat-0.11.2 (lib) (requires build)
...
Building base-orphans-0.8.4 (lib)
Building appar-0.1.8 (all, legacy fallback)
Downloaded memory-0.16.0
Downloading cryptonite-0.29
Installing base-orphans-0.8.4 (lib)
Downloaded cryptonite-0.29
Downloading some-1.0.3
...
You can see that for some libraries, they are specifically marked (lib), but other libraries are marked (all, legacy fallback).
What is the difference between these? What does legacy fallback mean?
I am using cabal-install version 3.4.0.0:
$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
I took a dive in the source code. The error message comes form here:
dispname = case elabPkgOrComp pkg of
ElabPackage _ -> prettyShow pkgid
++ " (all, legacy fallback)"
ElabComponent comp -> prettyShow pkgid
++ " (" ++ maybe "custom" prettyShow (compComponentName comp) ++ ")"
So I started looking for places where ElabPackage is constructed. I found this:
elaborateSolverToPackage
...
where
...
elab1 = elab0 {
elabUnitId = newSimpleUnitId pkgInstalledId,
elabComponentId = pkgInstalledId,
elabLinkedInstantiatedWith = Map.empty,
elabPkgOrComp = ElabPackage $ ElaboratedPackage {..},
elabModuleShape = modShape
}
This in turn is used here:
elaborateSolverToComponents mapDep spkg#(SolverPackage _ _ _ deps0 exe_deps0)
= case mkComponentsGraph (elabEnabledSpec elab0) pd of
Right g -> do
...
let not_per_component_reasons = why_not_per_component src_comps
if null not_per_component_reasons
then return comps
else do checkPerPackageOk comps not_per_component_reasons
return [elaborateSolverToPackage spkg g $
comps ++ maybeToList setupComponent]
Now the why_not_per_component is very interesting as that function determines when to use the legacy fallback. It is defined here:
-- You are eligible to per-component build if this list is empty
why_not_per_component g
= cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag ++ cuz_coverage
There in the code right below that we can see that it can be caused by these reasons:
The build-type is Custom or Configure
The cabal-version is less than 1.8
There are no buildable components
You passed the --disable-per-component flag.
Program coverage is enabled
So for the appar library it is because the cabal-version is 1.6 which is lower than 1.8, see https://github.com/kazu-yamamoto/appar/blob/v0.1.8/appar.cabal#L10.

Selenium Test Execution in Docker with UI

I tried running selenium test (Node Js) on docker machine but it says "TypeError: module.exports.browser.isElementPresent is not a function".
Note:
I can successfully run this same selenium test on my local machine
I tried running the same test on docker then i encountered the error above
root#6cd7ab2eb6f7:/usr/src# npm run kongaezv2
npm info it worked if it ends with ok
npm info using npm#4.1.2
npm info using node#v7.6.0
npm info lifecycle cerebro#0.0.1~prekongaezv2: cerebro#0.0.1
npm info lifecycle cerebro#0.0.1~kongaezv2: cerebro#0.0.1
> cerebro#0.0.1 kongaezv2 /usr/src
> mocha --recursive tests/kongaezv2 -t 9000000 --reporter mochawesome
execFile: tests/kongaezv2
execFilename: tests/kongaezv2.json
Konga EZ V2 Sanity Test
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
1) Log in with Email and Password
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
2) Serach for an item
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
3) Add an item to cart
ready to close browser
validating pagetitle
title = Konga Ez | Home
Title = Konga Ez | Home
Validation == PASS :: Page :Konga Ez | Home is displayed successfully
4) Checkout with POD
ready to close browser
0 passing (48s)
4 failing
1) Konga EZ V2 Sanity Test Log in with Email and Password:
TypeError: module.exports.browser.isElementPresent is not a function
at Object.elementpresent (helpers.js:25:47)
at Object.validateelementpresent (validations.js:57:13)
at Object.clickbutton (actions.js:74:13)
at frameworks/kongaezv2.js:67:19
at node_modules/async/dist/async.js:3830:24
at replenish (node_modules/async/dist/async.js:946:17)
at node_modules/async/dist/async.js:950:9
at eachOfLimit (node_modules/async/dist/async.js:975:24)
at node_modules/async/dist/async.js:980:16
at _parallel (node_modules/async/dist/async.js:3829:5)
at Object.series (node_modules/async/dist/async.js:4684:5)
at Object.login_with_email (frameworks/kongaezv2.js:65:15)
at Context.<anonymous> (tests/kongaezv2/kongaezv2.js:20:19)
at runTest (node_modules/selenium-webdriver/testing/index.js:164:22)
at node_modules/selenium-webdriver/testing/index.js:185:16
at new ManagedPromise (node_modules/selenium-webdriver/lib/promise.js:1085
:7)
at controlFlowExecute (node_modules/selenium-webdriver/testing/index.js:18
4:14)
at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092
:14)
at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:
3075:27)
at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2982:25)
at node_modules/selenium-webdriver/lib/promise.js:676:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: Konga EZ V2 Sanity Test Log in with Email and Password
at Context.ret (node_modules/selenium-webdriver/testing/index.js:183:10)
at node_modules/selenium-webdriver/testing/index.js:102:5
at ManagedPromise.invokeCallback_ (node_modules/selenium-webdriver/lib/pro
mise.js:1384:14)
at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:3092
:14)
at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:
3075:27)
at asyncRun (node_modules/selenium-webdriver/lib/promise.js:2935:27)
at node_modules/selenium-webdriver/lib/promise.js:676:7
at process._tickCallback (internal/process/next_tick.js:103:7)
2) Konga EZ V2 Sanity Test Serach for an item:
TypeError: module.exports.browser.isElementPresent is not a function
at Object.elementpresent (helpers.js:25:47)
at Object.validateelementpresent (validations.js:57:13)
at Object.sendkeys (actions.js:116:13)
at frameworks/kongaezv2.js:104:19
at node_modules/async/dist/async.js:3830:24
at replenish (node_modules/async/dist/async.js:946:17)
at node_modules/async/dist/async.js:950:9
at eachOfLimit (node_modules/async/dist/async.js:975:24)
at node_modules/async/dist/async.js:980:16
at _parallel (node_modules/async/dist/async.js:3829:5)
at Object.series (node_modules/async/dist/async.js:4684:5)
at Object.search (frameworks/kongaezv2.js:98:15)
You should install Xvfb more info available here here
Thanks #nick_gabpe installing xvfb worked for me. I used Chromium in Docker via Xvfb

chromium headless ozone build on linux x86_64 failed

I'm trying to perform an GN buld on Linux. and i get the folloging error:
obj/content/browser/browser/browser_main_loop.o:../../content/browser/browser_main_loop.cc:function content::BrowserMainLoop::PreMainMessageLoopRun(): error: undefined reference to 'views::WindowManagerConnection::Create(mojo::ApplicationImpl*)'
my Settings are:
is_debug = false
is_component_build = true
use_ozone=true
ozone_auto_platforms=false
ozone_platform_headless=true
is_headless=true
toolkit_views=false

How to setup classpath for slimv and ritz

I would like to resolve my problem for classpath.Could you tell me how to do?
I can do the following.
I can eval (+ 1 1) in vim(slimv) by pushing ,e.
Then slimv display the followings.
user>
(+ 1 1)
2
However,I can not do the followings.
1.When I eval the the following code in vim(slimv) by pushing ,e,
(use '[clojure.contrib.str-utils :only (re-split)])
2.Slimv displays the following error.
; Evaluation aborted on java.io.FileNotFoundException: Could not locate clojure/contrib/str_utils__init.class or clojure/contrib/str_utils.clj on classpath:
My enviroment is the followings.
macvim 7.3.754
lein 2.0.0
slimv 0.9.9
ritz 0.7.0
project.clj
(defproject helloworld "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.4.0"]]
:plugins [[lein-ritz "0.7.0"]]
)
~/.lein/profiles.clj
{:user {:plugins [
[lein-ritz "0.7.0"]
]}}
ref
lein ritz setup error
Have you tried clojure.string?
(use '[clojure.string :only (split)])
(split "clojure8*)-6contrib&(*does^&$not*_^%exist^*#anymore" #"[^a-zA-Z]+")
=> ["clojure" "contrib" "does" "not" "exist" "anymore"]
BTW all clojure.contrib have been migrated to separated libraries http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

Resources