So recently tried to create a suite in python to run tests on some twitter share buttons. I used the "switch_to_frame" function to navigate into the iframe and select the button. Here is my code
class EntertainmentSocialMedia(CoreTest):
def testEntertainmentTwitter(self):
d = self.driver
d.get(config.host_url + '/testurl')
social_text = 'Follow @twitterhandle'
print "Locating Entertainment vertical social share button"
time.sleep(3)
d.switch_to_frame(d.find_element_by_css_selector('#twitter-widget-0'))
social_button = d.find_element_by_xpath('//*[@id="l"]').text
self.assertTrue(str(social_text) in str(social_button))
print social_button
d.close()
My concern is that with multiple tests in the suite, sometimes selenium will timeout. Is there something wrong with my code or can it be improved? Ideally I'd like them to be as robust as possible and avoid timeouts. Thanks!