I have a django project where I am utilizing django_facebook for Facebook interactions and Selenium for automated system testing.
During the testing process, when attempting to log into Facebook from my application, I execute the following steps:
self.browser.get(self.live_server_url)
self.browser.find_element_by_xpath('//*[@id="facebook_login_js"]/input').click()
self.browser.switch_to_window(self.browser.window_handles[1])
self.login_to_facebook()
However, this fails because the initialization of Facebook's JS SDK is asynchronous and not yet completed. Although my tests used to work before, there seems to be a delay in the initialization now.
I've considered using fbAsyncInit as a solution, but this code is provided by django_facebook in a Javascript file which I prefer not to modify.
Do you have any suggestions on how to wait until the Facebook JS SDK is fully loaded so that I can utilize the login functionality?