Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 410573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:54:06+00:00 2026-05-12T17:54:06+00:00

I am using selenium RC to cycle through a long list of URLs, sequentially

  • 0

I am using selenium RC to cycle through a long list of URLs, sequentially writing the HTML from each URL to a csv file. Problem: the program frequently exits at various points in list due to URL “Timed out after 30000ms” exceptions. Instead of stopping the program when it hits a URL time-out, I was trying to have the program simply write a note of the time-out in the CSV file (in the row where the HTML for the URL would have gone) and move on to the next URL in the list. I attempted to add an ‘else’ clause to my program but it doesnt seem to help (see below) — ie: the program still stops every time it hits a timeout. I also seem to get 30000ms timeout exceptions even when I open selenium-server with a 60000ms timeout window –eg: “java -jar selenium-server.jar -timeout 600000” ???

Any advice would be much appreciated. Thank you.

from selenium import selenium
import unittest, time, re, csv, logging

class Untitled(unittest.TestCase):
    def setUp(self):
        self.verificationErrors = []
        self.selenium = selenium("localhost", 4444, "*firefox", "http://www.MainDomain.com")
        self.selenium.start()

    def test_untitled(self):
        sel = self.selenium
        spamReader = csv.reader(open('SubDomainList.csv', 'rb'))
        for row in spamReader:
            sel.open(row[0])
            sel.wait_for_page_to_load("400000")
            time.sleep(5)
            html = sel.get_html_source()
            ofile = open('output4001-5000.csv', 'ab')
            ofile.write(html + '\n')
            ofile.close
        else:
            ofile = open('outputTest.csv', 'ab')
            ofile.write("URL Timeout" + '\n')
            ofile.close

     def tearDown(self):
        self.selenium.stop()
        self.assertEqual([], self.verificationErrors)

if __name__ == "__main__":
     unittest.main()
  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:54:06+00:00Added an answer on May 12, 2026 at 5:54 pm

    Try the following:

    from selenium import selenium
    import unittest, time, re, csv, logging
    
    class Untitled(unittest.TestCase):
        def setUp(self):
            self.verificationErrors = []
            self.selenium = selenium("localhost", 4444, "*firefox", "http://example.com")
            self.selenium.start()
            self.selenium.set_timeout("60000")
    
        def test_untitled(self):
            sel = self.selenium
            spamReader = csv.reader(open('SubDomainList.csv', 'rb'))
            for row in spamReader:
                try:
                    sel.open(row[0])
                except Exception, e:
                    ofile = open('outputTest.csv', 'ab')
                    ofile.write("error on %s: %s" % (row[0],e))
                else:
                    time.sleep(5)
                    html = sel.get_html_source()
                    ofile = open('output4001-5000.csv', 'ab')
                    ofile.write(html.encode('utf-8') + '\n')
                ofile.close()
    
        def tearDown(self):
            self.selenium.stop()
            self.assertEqual([], self.verificationErrors)
    
    if __name__ == "__main__":
         unittest.main()
    

    Some comments:

    • You don’t need a wait_for_page_to_load after an open, that will cause you timeouts because once the page is loaded after the opeen, it will start waiting again and the page will not be loading.
    • Most of the failures you get from selenium (timeouts, object not found) can be caught with try-except statements
    • You should set the timeout in your tests withing the test itself (using set_timeout), that way it doesn’t depend on the way you start the server, it will always wait the time you wanted
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Selenium WebDriver with Testng (started using an .xml file) to test a
I'm using Selenium IDE 1.7.2 and Firefox 10.0.2 In the page which I'm writing
I am using Selenium 2 (latest release from Googlecode) and I have it firing
I am using Selenium to do testing, We write our test cases in HTML
I need to verify using Selenium (or similar framework) that certain HTML content/items are
I'm extensively using Selenium for integration testing. Works great for all normal stuff (HTML/AJAX),
Using Selenium WebDriver on several Windows 7 test workstations. FireBug Html of Button is
Using Selenium IDE, I am trying to locate a link within a table row.
I'm using selenium with IE 7,8,9 and for some reason, some CSS 3 locators
I am using Selenium for automating the tests. My application exclusively uses IE, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.