问题
When I try to launch
php behat.phar
The WebDriver firefox window pops up and then my feature test fails at first step and skips the rest. I get:
...
Given I am on "first.php" #FeatureContext::visit()
Session [url] not available and is not among the last 1000 terminated sessions.
Active sessions are[ext. key 51191ae0-8f6f-49d0-27b322967296]
...
If I only use behat the test passes. This happens only when I try to use selenium.
I'm using MinkExtension GivenIAmOn() premade function
my behat.yml:
default:
paths:
features: features
bootstrap: features/bootstrap
extensions:
mink_extension.phar:
mink_loader: 'mink.phar'
base_url: 'http://10.0.0.10/'
goutte: ~
selenium2:
wd_host: 'http://localhost:4444/wd/hub'
capabilities:
version: ''
My FeatureContext extends from MinkContext. I've been searching for a solution for days and I couldn't solve this.
I'm working with Windows 7 with firefox 26, selenium-server-standalone-2.42.2 and I tried lower versions as well. As I read in some issues, the session/"session-id"/url was broken some versions ago, but now it shouldn't. For some reason it can't pick the right session.
Sorry for the data quality, I don't have an internet connection at my workplace and it's quite restricted. That's why I use .phar files instead of using composer. I can't either copy-paste the files and so on. If I have to provide more data just tell me and I will.
回答1:
It sounds like a grid-level timeout issue. You should try to increase browserTimeout
and newSessionWaitTimeout
and see if that helps.
Source: Session not available and is not among the last 1000 terminated sessions.
Timeouts in the grid should normally be handled through
webDriver.manage().timeouts()
, which will control how the different operations time out.
The browserTimeout should be:
- Higher than the socket lock timeout (45 seconds).
- Generally higher than values used in
webDriver.manage().timeouts()
, since this mechanism is a "last line of defense".
For any issues, check also: http://localhost:4444/wd/hub/sessions
回答2:
I had the same problem, and logs of Selenium Grid are this :
WARN [RequestHandler.process] - The client is gone for session ext. key fa804448787370d0547cd517ab2badc1, terminating INFO [ActiveTestSessions.updateReason] - Removed a session that had not yet assigned an external key 24f5656a-7a59-4edb-bf7b-c6a1ae59ca16, indicates failure in session creation CLIENT_GONE
The error CLIENT_GONE
is :
"The client process (your code) appears to have died or otherwise not responded to our requests, intermittent network issues may also cause".
And I had some test that are waiting in queue (5 tests are waiting, while 5 other are running)
I solve this problem with just stoping to have queue on grid.
回答3:
I fixed the problem by using the same version of the selenium hub and the nodes: image: selenium/hub:3.11 AND image: selenium/node-chrome:3.11
来源:https://stackoverflow.com/questions/24446745/session-url-not-available-and-is-not-among-the-last-1000-terminated-sessions