Python Selenium: ConnectionRefusedError: No connection could be made because the target machine actively refused it

0 votes

This is the code I am using to scrape. I am trying to crawl through the pages.

for i in range(0,3):
    url="https://www.edureka.co/community/users?start=" + str(i*200)
    driver.get(url)
    time.sleep(3)
    driver.quit()

Loop runs one time and then I get this error.

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
Apr 5 in Python by Raj
89 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
When you use driver.quit(), it closes the complete browser session. When you are using in a loop I find it better to use driver.close()

Try this:

for i in range(0,3):
    url="https://www.edureka.co/community/users?start=" + str(i*200)
    driver.get(url)
    time.sleep(3)
    driver.close()

answered Apr 5 by Tina

Related Questions In Python

0 votes
1 answer

Python error: No handlers could be found for logger “xhtml2pdf”

The only solution is to define a ...READ MORE

answered Sep 5, 2018 in Python by Priyaj
• 56,120 points
90 views
0 votes
1 answer

Why is Python scoping made the way it is?

The likeliest answer is that it just ...READ MORE

answered Nov 5, 2018 in Python by Nymeria
• 3,500 points

edited Dec 17, 2018 by Nymeria 14 views
+1 vote
1 answer

What is the correct order to learn concepts in Python for machine learning?

Machine Learning is a vast domain. It ...READ MORE

answered Jul 25, 2018 in Python by ANMOL
• 3,620 points
31 views
0 votes
1 answer

Can't Click an Element in Python Selenium After Successfully Finding It

I've encountered this problem of not being ...READ MORE

answered Oct 4, 2018 in Python by Priyaj
• 56,120 points
618 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
75 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
448 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
56 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.