Visit All URLs with selenium python

Nicole bostananwar at gmail.com
Thu Apr 13 00:48:54 EDT 2017


        browser.get('https://www.google.co.uk/search?q=Rashmi&oq=Rashmi&aqs=chrome..69i57j69i60l3.6857j0j1&sourceid=chrome&ie=UTF-8#q=Rashmi+Custom+Tailors')
        time.sleep(5)

        try:        
            p_links = browser.find_elements_by_css_selector('div > h3 > a')
            url_list = []
            for urls in p_links:
                if "Rashmi Custom Tailors" in urls.text:
                    
                    url = urls.get_attribute("href")
                    url_list.append(url)
                    for url in url_list:
                        browser.get(url)
                        time.sleep(4)


it just visit first url not all .. Can anybody help how to fix that..



More information about the Python-list mailing list