Hi Zac and Roy,
Last week I found the facebook login iframe has the attribute "data-url", which
contains "m.facebook.com/login.php" string.
It is useful to find the login iframe.
# switch to facebook login frame
self.marionette.switch_to_frame()
# need to wait device connect to facebook...
time.sleep(10)
browser_frames = self.marionette.find_elements(*self._iframe_selector)
for browser_frame in browser_frames:
if self._facebook_login_url in
browser_frame.get_attribute("data-url"):
self.marionette.switch_to_frame(browser_frame)
break
After login, go back to app's frame then switch to iframe with
src="fb_import.html", then we can get the import page.
I also send a PR #447 for this test.
Best Regards,
Askeing
----- Original Message -----
From: "Zac Campbell" <[email protected]>
To: [email protected]
Sent: 2013年3月5日 星期二 22:38:33
Subject: Re: [b2g] Contacts -> link contact -> facebook ... I can't find this
facebook app with Marionette!
Roy,
I have only just joined this newsgroup but could have helped you with
this earlier.
What I usually do is just:
self.marionette.switch_to_frame() # to go to the top level frame
time.sleep(10) # to be 99.9% sure
the app has loaded
print self.marionette.page_source # to print the html of the top
level frame
and then to a ctrl-f find in the console for the string "facebook" or
the title of the app.
Crude, but it works.
I also published another blog post on frame switching last week.
Zac
On 05/03/2013 14:21, Roy Collings wrote:
> SOLVED!!
>
> GOT IT!!!!
>
> I ended up writing a utility to switch through every iframe, take a
> screenshot, dump the html and report the "src" attribute ... the result is
> that you need to switch to the iframe who has the attribute 'src' = "".
>
> This is not the same iframe as "self.marionette.switch_to_frame()".
>
> So I now use this to see the facebook iframe:
>
> self.connect_to_iframe("")
>
> def connect_to_iframe(self, p_name):
> iframes = self.marionette.execute_script("return
> document.getElementsByTagName('iframe')")
> for idx in range(0,iframes['length']):
> iframe = iframes[str(idx)]
> if p_name == iframe.get_attribute('src'):
> self.marionette.switch_to_frame(iframe)
> return True
> return False
>
> If that information about this iframe was available somewhere, it would've
> saved me about 7 hours of investigations.
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g