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
1,121 views

1 answer to this question.

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,920 points
217 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,520 points

edited Dec 17, 2018 by Nymeria 36 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
71 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,110 points
942 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
1,121 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
859 views
0 votes
1 answer