def setUp(self): super(TestCase, self).setUp() productPageURL = TT_Constants['Base_URL']+"store/p1/Leatherback_Turtle_Picture.html" self.navigate_to_page(productPageURL) common_obj = Common(self.driver) common_obj.wait_for_element_visibility(10, "id", "wsite-com-product-option-Quantity" ) mainWindowHandle = self.driver.window_handles common_obj.click(10, "xpath", "//a[@title='Share on Facebook']") allWindowsHandles = self.driver.window_handles for handle in allWindowsHandles: if handle != mainWindowHandle[0]: common_obj.switch_to_window(handle) break common_obj.wait_for_element_visibility(10, "id", "email" ) common_obj.fill_out_field("id", "email", TT_Constants['Facebook_Username'] ) common_obj.fill_out_field("id", "pass", TT_Constants['Facebook_Password'] ) common_obj.click(10, "name", "login") common_obj.wait_for_element_visibility(10, "name", "share" )
def setUp(self): super(TestCase, self).setUp() productPageURL = TT_Constants[ 'Base_URL'] + "store/p1/Leatherback_Turtle_Picture.html" self.navigate_to_page(productPageURL) common_obj = Common(self.driver) # Wait for the "Quantity" drop-down to display common_obj.wait_for_element_visibility( 10, "id", "wsite-com-product-option-Quantity") # Click the "Twitter" share link and switch to the "Twitter" login page mainWindowHandle = self.driver.window_handles common_obj.click(10, "xpath", "//a[@title='Share on Twitter']") allWindowsHandles = self.driver.window_handles for handle in allWindowsHandles: if handle != mainWindowHandle[0]: common_obj.switch_to_window(handle) break #Verify that the Twitter username/email field is displayed common_obj.wait_for_element_visibility(10, "id", "username_or_email") # Enter Twitter credentials and click the "Sign In and Tweet" button common_obj.fill_out_field("id", "username_or_email", TT_Constants['Twitter_Username']) common_obj.fill_out_field("id", "password", TT_Constants['Twitter_Password']) common_obj.click(10, "xpath", "//input[@value='Sign in and Tweet']") # Wait for the "Tweet" button to display. We locate the "Tweet" button by value using Css Selector common_obj.wait_for_element_visibility(10, "cssSelector", "input[value=Tweet]")
def setUp(self): super(TestCase, self).setUp() productPageURL = TT_Constants[ 'Base_URL'] + "store/p1/Leatherback_Turtle_Picture.html" self.navigate_to_page(productPageURL) common_obj = Common(self.driver) common_obj.wait_for_element_visibility( 10, "id", "wsite-com-product-option-Quantity") mainWindowHandle = self.driver.window_handles common_obj.click(10, "xpath", "//a[@title='Share on Facebook']") allWindowsHandles = self.driver.window_handles for handle in allWindowsHandles: if handle != mainWindowHandle[0]: common_obj.switch_to_window(handle) break common_obj.wait_for_element_visibility(10, "id", "email") common_obj.fill_out_field("id", "email", TT_Constants['Facebook_Username']) common_obj.fill_out_field("id", "pass", TT_Constants['Facebook_Password']) common_obj.click(10, "name", "login") common_obj.wait_for_element_visibility(10, "name", "share")