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 6, 2019 in Python by Raj
12,198 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 6, 2019 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
• 58,090 points
1,961 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,560 points

edited Dec 17, 2018 by Nymeria 399 views
0 votes
2 answers

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,500 points
12,765 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,629 views
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,910 points
6,703 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,567 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP