Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6786759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:17:00+00:00 2026-05-26T17:17:00+00:00

TL;DR : In a Behat+Mink ( @javascript w/ Sahi) scenario, Sahi enter some text

  • 0

TL;DR : In a Behat+Mink (@javascript w/ Sahi) scenario, Sahi enter some text in an <input>, and the Javascript in the page isn’t able to get what was entered by Sahi

UPDATE:

Solution : downloading the last version of Sahi fixed the problem. Whatever the bug was, it has been corrected.

Context

I’m building a little demo website, to show my team what Behat+Mink can do. There’s a few pages, where one can input the size of a square and get the perimeter of this square.
One page is using plain old POST method, another page is using Javascript to calculate the perimeter

Url of the “JS page” : http://behatdemo.widop.com/js-square

To show my team that testing javascript is possible, I’m using Sahi as Mink driver, however it doesn’t seems to work. I wrote a scenario where a user input 6 as the square side length, and get 24 as perimeter ([link to file on github] (https://github.com/clemherreman/behatdemo/blob/master/features/js_square.feature#L7))

@javascript
Scenario: Inputting a valid side size
Given I am on "/js-square"
When I fill in "side" with "6"
And I press "Calculate"
And I wait for the result to appear
And I wait a little
Then I should see "Perimeter (using js): 24 cm"

Note: And I wait a little is a debug steps that waits 10 seconds, to be able to look at what is displayed on the Sahi firefox window

Problem

It seems that the snippet of javascript that calculate the perimeter isn’t able to get the 6 inputed by Sahi. Here is the code ([link to file on github] (https://github.com/clemherreman/behatdemo/blob/master/website/views/js-square.twig#L27))

Instead of having "Perimeter (using js): 24 cm", I get a "Perimeter (using js): Error cm".

(function($) {
  $('form').submit(function(e) {
    e.preventDefault();
    // #side is a <input type="text"> tag, where user input a square side length
    var side = parseFloat(jQuery('#side').val()) || NaN;
    var perimeter = side*4.0 || 'Error';
    $('#sidebar').text('Perimeter (using js): '+perimeter+ ' cm');
  });
})(jQuery);

Debug/Ideas

After some investigation, it turns out that jQuery('#side').val()returns an empty string, which is why I get a “Error” displayed, instead of the perimeter.
It seems that Javascript isn’t able to get what was inputed by Sahi during the Scenario.

I’m pretty stuck on this one, I feel like I’m missing something.

Links :

  • Github project (with *.features): https://github.com/clemherreman/behatdemo
  • Live website: http://behatdemo.widop.com/js-square

Versions:

  • Behat: 2.1.2
  • Mink: 1.1.1
  • Sahi: 3.5
  • PHP: 5.3.6
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:17:01+00:00Added an answer on May 26, 2026 at 5:17 pm

    I was not able to reproduce your error, everythig went fine on my Behat/Mink/Sahi setup :
    http://screencast.com/t/2rTHo7jj

    Scenario passed

    I’m using Sahi 3.5 with Behat 2.1.2 and Mink 1.1.1 on OSX With latest version of Chrome & PHP 5.3.8-ZS5.5.0

    Try running your test under Chrome with :

    default:
      context:
        parameters:
          base_url: YOURBASEURL
          browser: chrome
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm playing around with some onset/beat detection algorithms on my own. My input is
I test my Symfony2 project with PHPUnit and behat/mink. This morning I added more
In the application that we have, we're doing some AJAX response. Once in a
The wikipedia page on TwoFish points at this reference implementation in C (and code
There are plenty of Chess AI's around, and evidently some are good enough to
On my old beat-up TI-83 I can get a reduced fraction representation of a
I have XML I'm trying to parse and get the status of each of
Behat is the leading BDD framework for PHP. I use PHPStorm and want to
Anyone has been using Behat with Zend Framework? Any examples on how to use
I am very much a fan of BDD and Behat for PHP. Is there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.