The easiest fix was to tweak selenium instead.
Selenium core mission is to automate the browser, not stripping
whitespace... which can be done by any programming language!
Cheers,
- Philippe
On Thursday, October 1, 2009, Simon Stewart wrote:
>
> TBH, I'd not noticed the fact that we'd tweaked the text we are
> returning from Selenium. I'd really like it if the API _stayed
> stable_. That's partly because the promise of 1.0 was a stable API and
> partly because I'm attempting to put together an implementation based
> on webdriver.
>
> In this case, my preference would be to roll back the change to the
> formatting of getText, which would restore our previous behaviour and
> remove the need for a change to the API, moving the responsibility for
> reformatting to the code that requested the text.
>
> Simon
>
> On Thu, Oct 1, 2009 at 1:07 PM, Patrick Lightbody wrote:
>>
>> I'd love to hear Simon's thoughts on this from the WebDriver/Selenium
>> 2.0 perspective. In general, I like the suggest feature, but I know
>> API is something Simon has a lot more leadership/intelligence on than
>> I do, and I'd like to see how he'd implement this...
>>
>> Patrick
>>
>> 2009/9/30 Ardesco :
>>>
>>> Dave,
>>>
>>> In this case I would say yes. This code does not remove any of the
>>> markup, just junk characters hidden within the markup that the browser
>>> will ignore anyway. Selenium currently trims the text it returns,
>>> this is really not so different, just an evolution in my opinion. The
>>> option is still there to not remove these characters and I know I have
>>> spent time before trying to debug a getText call that has failed only
>>> to find out that the text shown in firebug is not entirely accurate
>>> because a newline character has been slipped in somewhere. If
>>> anything this should help people who are less experienced with
>>> selenium and don't realise that this characters could be causing
>>> failures.
>>>
>>> If the markup contains something like a
tag this change will not
>>> touch the tag and if you are trying to match something across a
>>> and attempting to use the added clean functionality to remove the line
>>> break it will fail.
>>>
>>> It would have been quite possible to add this function to my existing
>>> test framework, but this seemed to be a cleaner way to do it, required
>>> less modification of my code base and is now something that I will
>>> have available in every test framework I generate without needing an
>>> additional clean function.
>>>
>>>> > @param locator an element locator <#locators>
Ditto Simon
Selenium core mission is to automate the browser, not stripping
whitespace... which can be done by any programming language!