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

Interesting case came up here.

Because appium doesn't return the page source of the frame when switched to
it ( https://github.com/appium/appium/issues/5199 ).

We attempted to do this method of executing Javascript to get the page
source. But due to some javascripting evils in the frame in question this
failed. Haven't quite isolated the root cause yet, but what do we want to
do for users that will potentially run into this same issue?

And this is horrendously difficult to debug :(


On Tue, Apr 21, 2015 at 11:42 AM, Alexei Barantsev <barancev@gmail.com>
wrote:

> ᐧ
> 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 Thursday, 4 June 2015 16:29:48 UTC