Python3+selenium 3.13 + geckodriver 21.0, prompt connectionreseterror, toggle the lower version of the driver can be

Source: Internet
Author: User
Tags connection reset

When learning selenium, if sleep time is greater than or equal to 5 seconds, it will prompt connectionreseterror: [Errno] Connection reset by peer.
Switch to Chrome to work.

#demo. pyFromSeleniumImportWebdriverFromTimeImportSleep,CTime#chrome#driver = Webdriver. Chrome (executable_path= '//users/csj/desktop/seleniumdriver/chromedriver/chromedriver ')#Firefoxdriver 21.0Driver=Webdriver.Firefox(Executable_path='//users/csj/desktop/seleniumdriver/firefoxdriver/21.0/geckodriver ')#Firefoxdriver 20.1#driver = Webdriver. Firefox (executable_path= '//users/csj/desktop/seleniumdriver/firefoxdriver/20.1/geckodriver ')#Firefoxdriver 20.0#driver = Webdriver. Firefox (executable_path= '//users/csj/desktop/seleniumdriver/firefoxdriver/20.0/geckodriver ')#Firefox 19.1#driver = Webdriver. Firefox (executable_path= '//users/csj/desktop/seleniumdriver/firefoxdriver/19.1/geckodriver ')Driver.Implicitly_wait(10)Driver.Get("Http://www.baidu.com")Print(CTime())Sleep(5)Print(CTime())Driver.find_element_by_id("KW").Send_keys("Selenium")Driver.Close()```UseFirefoxdriver21.0, report the following error:Traceback(MostRecentPagerLast):File"/users/csj/pycharmprojects/untitled/demo.py",Line13,Inch<Module>Driver.find_element_by_id("KW").Send_keys("Selenium")File"/users/csj/anaconda/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py",Line353,Inchfind_element_by_idReturnSelf.Find_element(By=By.Id,Value=Id_)File"/users/csj/anaconda/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py",Line957,InchFind_element' Value ':Value})[' Value ']File"/users/csj/anaconda/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py",Line312,InchExecuteResponse=Self.Command_executor.Execute(Driver_command,Params)File"/users/csj/anaconda/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py",Line472,InchExecuteReturnSelf._request(Command_info[0],Url,Body=Data)File"/users/csj/anaconda/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py",Line496,Inch_requestResp=Self._conn.GetResponse()File"/users/csj/anaconda/lib/python3.6/http/client.py",Line1331,InchGetResponseResponse.Begin()File"/users/csj/anaconda/lib/python3.6/http/client.py",Line297,InchBeginVersion,Status,Reason=Self._read_status()File"/users/csj/anaconda/lib/python3.6/http/client.py",Line258,Inch_read_statusLine=Str(Self.Fp.ReadLine(_maxline+1),"Iso-8859-1")File"/users/csj/anaconda/lib/python3.6/socket.py",Line586,InchReadintoReturnself. _sock. Recv_into (b) connectionreseterror : [errno 54]  Connection reset by peer replace firefox 20.120.0 19.1, can be run successfully without prompting  sleep time set to 10 seconds, no more error.   

Python3+selenium 3.13 + geckodriver 21.0, prompt for connectionreseterror, toggle lower version of driver

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.