Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

php - Session [url] not available and is not among the last 1000 terminated sessions. How to solve this?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...