Re: [WebDriver] getPageSource - Does it need to be a remote end call?

ᐧ
Yes, this looks like moving the whole atom to the client side :)

--
Alexei Barantsev, Software-Testing.Ru
mailto: barancev@gmail.com
phone: +7 (916) 726-95-55
skype : barancev

2015-04-21 20:37 GMT+03:00 Jason Leyba <jleyba@google.com>:

> Every browser should be covered by outerHTML or XMLSerializer. If you want
> to be paranoid, you can add an extra clause to clone the tree (ouch) as a
> child of another node and return the innerHTML:
>
> var source = document.documentElement.outerHTML;
> if (!source) {
>   if (typeof XMLSerializer !== 'undefined') {
>     source = new XMLSerializer().serializeToString(document);
>   } else {
>     var div = document.createElement('div');
>     div.appendChild(document.documentElement.cloneNode(true));
>     source = div.innerHTML;
>   }
> }
> return source;
>
> On Tue, Apr 21, 2015 at 10:09 AM Luke Inman-Semerau <
> luke.semerau@gmail.com> wrote:
>
>> That works on "everything"? Do we care about htmlUnit? (That's a bit of a
>> rhetorical question)
>>
>> -Luke
>>
>> > On Apr 21, 2015, at 9:42 AM, James Graham <james@hoppipolla.co.uk>
>> wrote:
>> >
>> >> On 21/04/15 17:28, Luke Inman-Semerau wrote:
>> >> So the local end needs to be context aware of what browser it is
>> >> running? Or we basically include a page source Atom on the client and
>> >> push the whole thing across the wire to handle all browsers?
>> >
>> > No, of course not.
>> >
>> > var source = document.documentElement.outerHTML;
>> > if (!source) {
>> >  source = new XMLSerializer().serializeToString(document);
>> > }
>> > return source;
>> >
>> >
>> >
>>
>>

Received on Tuesday, 21 April 2015 18:43:06 UTC