Spurious page output when using $this-getSession()->getPage()->find()

37 views
Skip to first unread message

Betamax

unread,
Sep 21, 2012, 6:34:13 AM9/21/12
to Behat
hello again, to the rather helpful and supportive behat community.
I am not a developer by trade so am finding this quite confusing. So
am just reaching out for some feedback.
My behat tests are outputting noise and I am pretty sure
they didn't before, perhaps since the 2.4 upgrade, perhaps not.

Basically, Behat FeatureContext extends Behat\MinkExtension\Context
\MinkContext which is passed to the subcontext step definition.

Using the following I grab the session, the driver and then the
browser to open a page:

$this->_session = $this->getMainContext()->getSession();
$this->_browser = $this->_session->getDriver()->getBrowser();
$this->_browser->open($myLoginPage);

Perhaps it seems a bit inconsistent but in the next step, I use a
getPage on the session as follows:

$this->_page = $this->_session->getPage();
$this->_page->getSession();

Now the next step, and the one that causes the problem, reads as
follows:

$usernameField = $this->_page->find('css', '#email');

And this command, while it works fine, and the step completes, before
it completes it seems to dump the entire contents of the page into the
command line, eg.g);

Driver .php ....OK,<head><meta charset="utf-8"><script>function
envFlush(a){function b(c){for(var d in a)c[d]=a[d];}
if(window.requireLazy){requireLazy(['Env'],b);}else{Env=window.Env||
{};b(Env);}}
envFlush({"user":"0","locale":"en_GB","method":"GET","svn_rev":
631874,"tier":"h2e","vip":"173.252.101.16","static_base":"http:\/\/
static.ak.fbcdn.net\/","www_base":"http:\/..........

Believe me, this is just a snippet that represents 1% of the output.

I'd just love to know why this is doing so.

I'm sure the more developer savvy amongst you, and the Godfather of
Behat, Konstantin himself, are going to tell me to stick to using the
Mink API because it's cleaner, or at least stick to just the one API,
but sometimes I find myself dipping in out of both APIs becasue Mink
is clean and solid, but then again Selenium has 145 methods available
to me. Maybe this is really bad practice?

Anyway, if you could give me any clues and how best to avoid this
output, that would be awesome.

Thanking you in advance.


Reply all
Reply to author
Forward
0 new messages