SahiClient icon indicating copy to clipboard operation
SahiClient copied to clipboard

Incorrect getText() behaviour

Open cakper opened this issue 13 years ago • 3 comments

I found differences between drivers behaviour (Selenium2 and Sahi).

I have following html: https://gist.github.com/2407644 (all li elements are hidden) and mink scenario:

Then I should not see "penny" in the "#friend-picker-container" element

When I'm using Selenium 2 driver my test is passing, and everything is ok, but, when Sahi driver is in use I'm getting failure.

After debugging i found what cause problem - in method

public function assertElementNotContainsText($element, $text) (BaseMinkContext class)

function $node->getText() returns string(0) "" for Selenium2 but for Sahi result is string(75) "Me Add to Bill (penny) Add to Bill (lennard) Add to Bill (rash) Add to Bill"

In Sahi, implementation of this method is following: return $this->con->evaluateJavascript(sprintf('_sahi._getText(%s)', $this->getAccessor())); but (according to Sahi documentation) _sahi._getText() returns whole text (from invisible child elements too)

cakper avatar Apr 17 '12 17:04 cakper

confirmed

cadavre avatar Apr 17 '12 19:04 cadavre

I'm sorry, I forgot environment spec: Firefox 11.0, Ubuntu 11.10 64bit, Sahi OS 20110719

cakper avatar Apr 18 '12 10:04 cakper

@cakper, can you send an PR with a fix? Be sure to include new test case (that specifically tests, that a visible only text is returned) in GeneralDriverTest (separate pr to Behat\Mink repo).

aik099 avatar Jan 04 '14 19:01 aik099