PhantomJS or Selenium Standalone killed after first failed tests - selenium

I don't know if this is a Protractor or PhantomJS error.
I'm running this command, getting this log.
It seems like PhanthomJS or Selenium Standalone is dying after the fist fail test.
Do you need more logs/details to check where is the issue?
$ grunt accept:standalone --suite=list
Running "env:rde" (env) task
Running "shell:protractor_update" (shell) task
selenium standalone is up to date.
chromedriver is up to date.
Running "protractor_webdriver:start" (protractor_webdriver) task
Starting Selenium server
Started Selenium server: http://127.0.0.1:4444
Running "protractor:test" (protractor) task
Using the selenium server at https://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Session created: loggingPrefs=org.openqa.selenium.logging.LoggingPreferences#255d17d7, count=1, browserName=phantomjs, phantomjs.binary.path=c:\git\clients\special-offers\node_modules\phantomjs\lib\phantom\phantomjs.exe, version=ANY
Preparing new session
.FF
Failures:
1) Special Offers list page should have a thumbnail, a title, a description and a CTA
Message:
NoSuchElementError: No element found using locator: By.cssSelector(".ss .details p.body-copy")
2) sssssssssssssss
Message:
UnknownError: Error communicating with the remote browser. It may have died.
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'CBA-D013', ip: 'xxxxxx', os.name: 'Windows NT (unknown)', os.arch: 'amd64', os.version: '6.2', java.version: '1.6.0_26'
Driver info: driver.version: EventFiringWebDriver
Finished in 29.282 seconds
3 tests, 6 assertions, 2 failures
Session deleted: Keeping the Selenium server alive
c:\git\clients\special-offers\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113
var template = new Error(this.message);
^
>>
>> Test failed but keep the grunt process alive.
Running "shell:kill_selenium" (shell) task
Shutting down Selenium server: http://127.0.0.1:4444
Done, without errors.
Bye all!

Related

Laravel + sail + dusk => Error: Could not start a new session [...] Chrome failed to start

I just can't get Laravel dusk running. I've searched the internet and tried almost everything. I hope anyone knows the trick.
To rule out any self introduced problems I stated with a brand new Laravel project: curl -s "https://laravel.build/example-app" | bash. I'm using a Macbook Air (M1 chip) and therefore I have to change the docker-compose.yml and add platform=linux/amd64 to the containers. Thereafter ran ./vendor/bin/sail build and started up the containers. Next installed Dusk: ./vendor/bin/sail composer require --dev laravel/dusk and ran the install command (./vendor/bin/sail artisan dusk:install) as by the documentation.
At this point no additional modifications in any file have been made. Laravel Dusk ships with the default browser test. (tests/Browser/ExampleTest.php) When I run the command ./vendor/bin/sail dusk the following error will show:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\SessionNotCreatedException: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '64671e354051', ip: '192.168.32.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13'
Driver info: driver.version: unknown
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '64671e354051', ip: '192.168.32.3', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.76-linuxkit', java.version: '11.0.13'
Driver info: driver.version: unknown
/var/www/html/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:125
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:372
/var/www/html/vendor/php-webdriver/webdriver/lib/Remote/RemoteWebDriver.php:131
/var/www/html/tests/DuskTestCase.php:46
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:219
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/helpers.php:243
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:220
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:98
/var/www/html/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:66
/var/www/html/tests/Browser/ExampleTest.php:21
What I tried
The files in ./vendor/laravel/dusk/bin/ have the right permissions.
./vendor/bin/sail artisan dusk:chrome-driver --all => ChromeDriver binary successfully installed for version 100.0.4896.60. . But the same dusk error will show.
Tried to run the ChromeDriver directly: ./vendor/bin/sail bash => ./vendor/laravel/dusk/bin/chromedriver-linux. This results in an error:
./vendor/laravel/dusk/bin/chromedriver-linux: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
I Found an other StackOverflow post to fix this issue by installing the following packages via the sail root-shell: apt update; apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev;. Now the chromedriver-linux is starting without errors. Dusk still fails with the same error.
Has anyone a clue?
I was getting the same error when running sail artisan dusk.
When started using sail dusk instead everything worked.

WebDriverException: unknown error: Chrome failed to start: exited abnormally error running Selenium Grid on Server using ChromeDriver and Chrome

Good evening,
I tried to run my automated tests on a server with Eclipse / Selenium and TestNG. So far the configuration of Selenium Grid worked fine. I got the response:
23:02:55.068 INFO - Selenium Grid hub is up and running
23:03:30.488 INFO - Registered a node http://81.169.xxx.xxx:5555 <br>
23:05:25.423 INFO - Registering the node to the hub: http://81.169.xxx.xxx:4444/grid/register
23:05:25.432 INFO - The node is registered to the hub and ready to use
Here's my example code:
#Test
public void executeOnServer() throws MalformedURLException {
System.out.println("Test started");
DesiredCapabilities dcp = new DesiredCapabilities();
dcp.setBrowserName("chrome");
dcp.setPlatform(Platform.ANY);
WebDriver driver = new RemoteWebDriver(new URL("http://81.169.xxx.xxx:5555/wd/hub/"), dcp);
driver.manage().window().maximize();
driver.get("https://google.de");
driver.quit();
}
Unfortunately I got the error:
[RemoteTestNG] detected TestNG version 6.14.3
Test started
FAILED: executeOnServer
org.openqa.selenium.WebDriverException: unknown error: **Chrome failed to start: exited abnormally.**
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'h28xxxxx.stratoserver.net', ip: '81.169.xxx.xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x559967ec9ea9 <unknown>
The path to the chromedriver is:
usr/local/bin/chromedriver
Installed version:
https://chromedriver.storage.googleapis.com/index.html?path=**84.0.4147.30**/chromedriver_linux64.zip
Do you have any idea how I could fix the error? Had a look at different sites with this error, no solution is working for me.
This error message...
Test started
FAILED: executeOnServer
org.openqa.selenium.WebDriverException: unknown error: **Chrome failed to start: exited abnormally.**
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'h28xxxxx.stratoserver.net', ip: '81.169.xxx.xxx', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0', java.version: '1.8.0_252'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x559967ec9ea9 <unknown>
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=84.0
Possibly you are using the latest chrome=84.0
Your Selenium Client version is 3.4.0 of revision: 'unknown', time: 'unknown'
So that implies the ChromeDriver is unable to interact with the Selenium bindings as there is a clear mismatch between Selenium v3.4.0 and the ChromeDriver v84.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v84.0 level.
Chrome is updated to current Chrome Version 84.0 level. (as per ChromeDriver v84.0 release notes)
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

running selenium webdriver with firefox profile results in WebDriverError: connection refused

I am trying to start a selenium test with the following command
selenium-side-runner --server http://127.0.0.1:4444/wd/hub --debug -c
"browserName='firefox' moz:firefoxOptions.args=[-profile, /home/seluser.
/firefox-profile/myprofile]" --output-directory ~/out ~/portallogin.side
The profile is loaded correctly in firefox then but the test fails to run with the following exception:
Test suite failed to run
WebDriverError: connection refused
Build info: version: '3.141.59', revision: '82b03c358b', time: '2019-04-30T22:04:50'
System info: host: 'd871aae50a23', ip: '172.17.0.3', os.name: 'Linux', os.arch:
'amd64', os.version: '4.4.0-1075-aws', java.version: '1.8.0_212'
Driver info: driver.version: unknown
remote stacktrace:
at Object.checkLegacyResponse (../../../usr/lib/node_modules/
selenium-side-runner/node_modules/selenium-webdriver/lib/error.js:585:15)
at parseHttpResponse (../../../usr/lib/node_modules/
selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:551:13)
at Executor.execute (../../../usr/lib/node_modules/
selenium-side-runner/node_modules/selenium-webdriver/lib/http.js:486:26)
While running the same test without the profile beeing loaded is working.
I have found this issue: https://github.com/SeleniumHQ/selenium-ide/issues/616 and it looks like a bug.
I tried to add a .side.yml file but that didn't help yet.
It looks like the loading of a profile is disabling the webdriver functionallity in firefox. Any hints how to get it running?
There is a workaround provided here https://github.com/mozilla/geckodriver/issues/1058#issuecomment-350254437
We need to pass the --marionette-port 2828 during the selenium execution.

Exception when run Serenity tests on Jenkins in Seelnium grid

I run tests on my locale machine (not in grid), and it works. However, when I run on Jenkins, on Linux server in selenium grid, I have strange error:
net.serenitybdd.core.exceptions.SerenityManagedException: The following error occurred: Expected condition failed: waiting for core.common.utils.WebDriverUtil$$Lambda$195/1333459330#4f5c82fa (tried for 30 second(s) with 500 MILLISECONDS interval)
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'fr-woqa01', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.16.0-4-amd64', java.version: '1.8.0_131'
Driver info: net.thucydides.core.webdriver.WebDriverFacade
at net.serenitybdd.core.exceptions.SerenityManagedException.detachedCopyOf(SerenityManagedException.java:21)
at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:419)
at net.thucydides.core.steps.StepInterceptor.runOrSkipMethod(StepInterceptor.java:151)
at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:138)
at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:69)
at serenity.steps.HomePageSteps$$EnhancerByCGLIB$$c60d4147.openPage()
at jbehave.scenariosteps.LoginPageScenario.navigateToPage(LoginPageScenario.java:26)
(reflection-invoke)
at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:733)
at org.jbehave.core.embedder.PerformableTree$FineSoFar.run(PerformableTree.java:346)
I run test using command:
-pl ui verify -Dstory.file.name=${story_name} -Denv.config.file=qa.properties -Dwebdriver.remote.url=http://localhost:4444/wd/hub -Dwebdriver.remote.driver=chrome -Dwebdriver.remote.os=LINUX -Dchrome.switches="--no-sandbox,--ignore-certificate-errors,--homepage=about:blank,--no-first-run, --disable-gpu, --disable-impl-side-painting, --disable-gpu-sandbox, --disable-accelerated-2d-canvas, --disable-accelerated-jpeg-decoding, --test-type=ui"
Any help?
The error tells serenity cannot talk to webdriver. Which could be either due to chromedriver not avaliable on the jenkins slave/jenkins machine or chrome itself not installed on the jenkins machine.
Run these commands on to check if chrome /chrome driver is installed on jenkins machine
which chromedriver
which google-chrome

Selenium Grid with Protractor: SessionNotCreatedError at Object.checkLegacyResponse

I'm new to Selenium Grid and I'm trying to execute a protractor test on a remote node.
I'm using a Virtual Machine as Hub, the Node is my local machine which is also the client.
Both hub and node are up and running.
I've set the property seleniumAddress correctly in the conf.js file.
So now when I execute my test by running protractor conf.js, I'm getting this error:
E/launcher - SessionNotCreatedError: Unable to create new service:
ChromeDriverService
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-
08T15:15:08.936Z'
System info: host: 'host-name', ip: 'ip-address', os.name: 'Windows 7',
os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_171'
Driver info: driver.version: unknown
at Object.checkLegacyResponse
I have no idea why I'm getting this error. I tried to fix it by running:
webdriver-manager clean
webdriver-manager update
but it didn't help.
I solved this problem by specifying the location of the chromedriver executable using the argument Dwebdriver.chrome.driver. This argument should be set when starting the node.
chromedriver documentation