@@ -1824,6 +1824,8 @@ def pick_select_option_by_value(self, dropdown_selector, option,
18241824 dropdown_by = dropdown_by , option_by = "value" ,
18251825 timeout = timeout )
18261826
1827+ ############
1828+
18271829 def generate_referral (self , start_page , destination_page ):
18281830 """ This method opens the start_page, creates a referral link there,
18291831 and clicks on that link, which goes to the destination_page.
@@ -1843,7 +1845,7 @@ def generate_referral(self, start_page, destination_page):
18431845 referral_link = ('''<a class='analytics referral test' href='%s' '''
18441846 '''style='font-family: Arial,sans-serif; '''
18451847 '''font-size: 30px; color: #18a2cd'>'''
1846- '''* Magic Link Button! * </a>''' % destination_page )
1848+ '''Magic Link Button</a>''' % destination_page )
18471849 self .execute_script (
18481850 '''document.body.innerHTML = \" %s\" ''' % referral_link )
18491851 time .sleep (0.1 )
@@ -1861,6 +1863,32 @@ def generate_traffic(self, start_page, destination_page, loops=1):
18611863 self .generate_referral (start_page , destination_page )
18621864 time .sleep (0.05 )
18631865
1866+ def generate_referral_chain (self , pages ):
1867+ """ Use this method to chain the action of creating button links on
1868+ one website page that will take you to the next page.
1869+ (When you want to create a referral to a website for traffic
1870+ generation without increasing the bounce rate, you'll want to visit
1871+ at least one additional page on that site with a button click.) """
1872+ if not type (pages ) is tuple and not type (pages ) is list :
1873+ raise Exception (
1874+ "Exception: Expecting a list of website pages for chaining!" )
1875+ if len (pages ) < 2 :
1876+ raise Exception (
1877+ "Exception: At least two website pages required for chaining!" )
1878+ for page in pages :
1879+ # Find out if any of the web pages are invalid before continuing
1880+ if not page_utils .is_valid_url (page ):
1881+ raise Exception (
1882+ "Exception: Website page {%s} is not a valid URL!" % page )
1883+ for page in pages :
1884+ self .generate_referral (None , page )
1885+
1886+ def generate_traffic_chain (self , pages , loops = 1 ):
1887+ """ Similar to generate_referral_chain(), but for multiple loops. """
1888+ for loop in range (loops ):
1889+ self .generate_referral_chain (pages )
1890+ time .sleep (0.05 )
1891+
18641892 ############
18651893
18661894 def wait_for_element_present (self , selector , by = By .CSS_SELECTOR ,
0 commit comments