Protractor - error when starting webdriver-manager, seleniumProcess.pid: undefined - angularjs

I am facing a problem when starting webdriver-manager in node_modules\protractor with windows 7. the command is :
node webdriver-manager start
Then I got the following error messages:
seleniumProcess.pid: undefined
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at exports._errnoException (util.js:742:11)
at Process.ChildProcess._handle.onexit (child_process.js:1028:32)
at child_process.js:1109:20
at process._tickCallback (node.js:343:11)
at Function.Module.runMain (module.js:492:11)
at startup (node.js:124:16)
at node.js:807:3
After searching on the Internet, I cannot find any similar question like mine that the seleniumProcess.pid is undefined.
Following is the output for java -version:
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Any idea?

Ok, I figured out why I had this problem. You have only JRE, but
You will need to have the Java Development Kit (JDK) installed to run
the standalone Selenium Server. Check this by running java -version
from the command line. Tutorial
On Ubuntu I've done
$ sudo apt-get install openjdk-7-jdk
And now I have this Java:
$ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-0ubuntu0.15.10.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
And webdriver-manager start works.

Error:
C:\XXXX\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriv
er-manager\bin>webdriver-manager --verbose update
events.js:160
throw er; // Unhandled 'error' event
^
Error: unable to verify the first certificate
at Error (native)
at TLSSocket. (_tls_wrap.js:1092:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:610:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38)
I did the following to remove this:
Try:
1. C:\XX\Roaming\npm\node_modules\protractor\node_modules\webdriv
er-manager\bin>webdriver-manager --proxy http://username:passwd#IP:port
080/ update
(Then it updated drivers in the location)
webdriver-manager status
C:\XX\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\bin>webdriver-manager --verbose start
It is started working,
I expect this is happening repeatedly due to corruption of drivers. May we need to graceful stop to work.

Try to add C:\Windows\System32\ there (right-click My Computer -> Properties -> Advanced system settings -> Environment Variables -> Edit... PATH and add C:\Windows\System32 to the end (with a semi-colon separating each variable).

Related

Getting an error while the project running on android

I'm trying run my project on android. But I get an error like that.
C:\Users\Alperen\Desktop\AwesomeProject>npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\Alperen\Desktop\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\Users\Alperen\Desktop\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\Alperen\Desktop\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async Command.handleAction (C:\Users\Alperen\Desktop\AwesomeProject\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:164:9)
I don't understand. What should I do ?

Unable to run the first time react-native app for android on mac

I'm trying to run the react-native application on the macbook for android version.So I have followed all the step for setting up the environment on the machine from here :
https://facebook.github.io/react-native/docs/getting-started.html
And I have successfully install Android Studio,Android SDK, JDK, Node, NPM, Watchman, Homebrew
javac -version : 9
node -v : v8.9.1
npm -v: 5.5.1
watchman version: 4.9.0
When I tried to run the application with the command
react-native run-android
I got this error :
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/aman/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.925 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
According to this GitHub issue, this issue has to do with JDK version. Make sure you're using v8, not v9, then the error should not occur.
Yes, according to #Sam Hanley it's an issue with the java version update. So, with worrying about the version update/downgrade, we can pass on with this issue by the following process;
First, update the distributionUrl in gradle-wrapper.properties
ie: located in this path;
PROJECT_PATH/android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
Set $JAVA_HOME environment variable using the installed android studio app path (Android studio should be installed)
export JAVA_HOME="/Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home"
(PS: solution for macOS )
Hope this help!
I was able to get past this particular problem by doing the following:
Edit path_to_your_project/android/gradlew
Change DEFAULT_JVM_OPTS="" to DEFAULT_JVM_OPTS="--add-modules java.se.ee"

protractor not starting selenium

I am encounteing following error when starting an end to end test using protractor.
manu#MANU:/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app$ ./node_modules/protractor/bin/protractor ./conf.js
[16:29:47] I/launcher - Running 1 instances of WebDriver
[16:29:47] I/direct - Using ChromeDriver directly...
[16:29:47] E/launcher - EINVAL: invalid argument, uv_interface_addresses
[16:29:47] E/launcher - Error: EINVAL: invalid argument, uv_interface_addresses
at Error (native)
at getLoInterface (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/net/index.js:30:20)
at getAddress (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/net/index.js:46:14)
at Object.exports.getLoopbackAddress (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/net/index.js:85:10)
at resolveCommandLineFlags.then.args (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/remote/index.js:240:24)
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
at Function.createSession (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/lib/webdriver.js:777:24)
at Function.createSession (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/selenium-webdriver/chrome.js:709:29)
at Direct.getNewDriver (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/lib/driverProviders/direct.ts:90:25)
at Runner.createBrowser (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/lib/runner.ts:225:39)
at q.then.then (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/lib/runner.ts:391:27)
at _fulfilled (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:796:13)
at /mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/q/q.js:137:13)
[16:29:47] E/launcher - Process exited with error code 199
manu#MANU:/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app$
I could be because of issue in starting webdriver. I tried to run selenium but I got following error
manu#MANU:/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app$ ./node_modules/protractor/bin/webdriver-manager start
[16:27:55] I/start - java -Djava.security.egd=file:///dev/./urandom -Dwebdriver.chrome.driver=/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.32 -Dwebdriver.gecko.driver=/mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.18.0 -jar /mnt/c/Users/Manu/Documents/manu/programs/web/angular/dw-ng2-app/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.5.3.jar -port 4444
[16:27:55] I/start - seleniumProcess.pid: undefined
[16:27:55] W/start - Selenium Standalone server encountered an error: Error: spawn java ENOENT
I have tried cleaning and restarting using clean and start options with webdriver-manager but that hasn't solved the problem
Update---
I am running this on Windows machine through Bash for Windows. The issue with starting Selenium is Bash cannot find Java. I exported Path but because Java is installed in Program Files, I am unable to set the path in Bash as Bash is unable to process the space in Program Files. I could run the selenium server on CMD where JAVA path is set. The problem is still not resolved though.
It seems the issue was I didn't install correctly the first time. I should have run webdriver-manager update from home directory. I cleaned up using webdriver-manger clean and re-run webdriver-manger start from project's home directory project home> .\node_modules\protractor\bin\webdriver-manager start. Probably the installation sets some paths which get messed up if some other directory is used. I also started protractor from project's home directory >node .\node_modules\protractor\bin\protractor .\protractor.conf.js

Protractor 0.16.1 e2e AngularJS - Starting selenium standalone server... events.js:72 Error: spawn ENOENT

Attempted Project: https://github.com/yearofmoo/angularjs-seed-repo
Environment:
Windows 7 64-bit
NodeJS v 0.10.24
Protractor v 0.16.1
grunt v0.4.2
grunt-cli v0.1.11
Notes:
For selenium, install_selenium_standalone has been replaced by webdriver-manager binary around 12/2/13 according to [Julie's post][1]. This seems to be related to the issue.
Also, git must be installed in the project directory and npm install must be run using Git Bash in Windows.
Error in Git Bash:
$ grunt test:e2e --debug
Running "connect:testserver" (connect) task
[D] Task source: c:\nodejs-0.10.24\node_modules\grunt-contrib-connect\tasks\conn
ect.js
Started connect web server on 127.0.0.1:9999.
Running "protractor:singlerun" (protractor) task
[D] Task source: c:\nodejs-0.10.24\node_modules\grunt-protractor-runner\tasks\pr
otractor_runner.js
Starting selenium standalone server...
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
>
Fatal error: protractor exited with code: 8
Java is required to run selenium, so it seems You don't have any.

Cannot install YUM in MacOS

I'm trying to run the build script from HTML5 Boilerplate and I have to install YUM for that. I am on Mac OS Snow Leopard 10.6.8. When I did sudo port install yum, i'm getting the following error. Any idea how can I rectify it and install yum properly?
---> Computing dependencies for py24-nose
---> Dependencies to be installed: py24-distribute
---> Activating py24-distribute #0.6.24_0 Error: Target org.macports.activate returned: Image error:
/opt/local/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg-info
already exists and does not belong to a registered port. Unable to
activate port py24-distribute. Use 'port -f activate py24-distribute'
to force the activation. Error: Failed to install py24-distribute Log
for py24-distribute is at:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-distribute/py24-distribute/main.log
Error: The following dependencies were not installed: py24-distribute
Error: Unable to upgrade port: 1 Error: Unable to execute port:
upgrade py24-nose failed To report a bug, see
<http://guide.macports.org/#project.tickets>
Previously after installing YUM, i was getting Segmentation Fault, so I uninstalled and installed it again using Macports to get the above error.
I think you've got the wrong end of the stick here. You do not need to install YUM on the Mac. In fact, that act is sheer madness, because you already have a perfectly good package manager in the shape of MacPorts!
Read again what it says
If you're on Mac or Linux...
You've got all your dependencies pre-installed, likely. You may need a yum install ant-contrib or what have you.
The key bit there is "or what have you". That is a cryptic way of saying "or the equivalent command for your package manager". On Red Hat-based systems, the package manager is indeed YUM; on Debian systems, it's APT; on the Mac, it's MacPorts.
So, remove your YUM installation, and simply do:
port install ant-contrib
You can now proceed to actually running Ant.

Resources