geckodriver的一次坑,求大神解答

小同伙们再也来求助了有未有精晓这一个荒诞怎么消除???File"C:MySpiderAddUrlAddUrlspidersadd.py",line49,inGetCommentpage_source=driver.page_sourceFile"E:Anacondalibsite-packagesseleniumwebdriverremotewebdriver.py",line679,inpage_sourcereturnself.execute(Command.GET_PAGE_SOURCE)['value']File"E:Anacondalibsite-packagesseleniumwebdriverremotewebdriver.py",line321,inexecuteself.error_handler.check_response(response)File"E:Anacondalibsite-packagesseleniumwebdriverremoteerrorhandler.py",line242,incheck_responseraiseexception_class(message,screen,stacktrace)selenium.common.exceptions.InvalidArgumentException:Message:unexpectedendofhexescapeatline1column2111274

是贰个活动验证程序,当页面现身有个别标签且标签名符串为某某时,就举行验证码拖动。程序会60秒刷新一下以此界面,经过几天的测量检验,有时刚启航几分钟就终止了,有的时候候运行后大多少个钟头才会告风流潇洒段落。结束后,终端不会脱离,浏览器也不会被关闭,终端展现如下:Traceback(mostrecentcalllast卡塔尔(قطر‎:File"C:UsersAdministratorDocumentsgeetestjiyan.py",line176,inmodulecrawl.openBrowser()File"C:UsersAdministratorDocumentsgeetestjiyan.py",line34,inopenBrowserself.runCx()File"C:UsersAdministratorDocumentsgeetestjiyan.py",line67,inrunCxtextStr=self.browser.find_element_by_id('status').textFile"C:PythonPython37libsite-packagesseleniumwebdriverremotewebelement.py",line76,intextreturnself._execute(Command.GET_ELEMENT_TEXT)['value']File"C:PythonPython37libsite-packagesseleniumwebdriverremotewebelement.py",line633,in_executereturnself._parent.execute(command,params)File"C:PythonPython37libsite-packagesseleniumwebdriverremotewebdriver.py",line321,inexecuteself.error_handler.check_response(response)File"C:PythonPython37libsite-packagesseleniumwebdriverremoteerrorhandler.py",line242,incheck_responseraiseexception_class(message,screen,stacktrace)selenium.common.exceptions.StaleElementReferenceException:Message:staleelementreference:elementisnotattachedtothepagedocument(Sessioninfo:chrome=75.0.3770.90)C:UsersAdministrators)File"C:PythonPython37libsite-packagesseleniumwebdriverremotewebdriver.py",line321,inexecuteself.error_handler.check_response(response)File"C:PythonPython37libsite-packagesseleniumwebdriverremoteerrorhandler.py",line242,incheck_responseraiseexception_class(message,screen,stacktrace)selenium.common.exceptions.StaleElementReferenceException:Message:staleelementreference:elementisnotattachedtothepagedocument(Sessioninfo:chrome=75.0.3770.90)

Python3.6 Selenium打不开Ie浏览器

Traceback (most recent call last):
  File "./se3.py", line 16, in <module>
    dr=webdriver.Firefox(firefox_binary=binary,executable_path=driver_path)
  File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 154, in __init__
    keep_alive=True)
  File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 151, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 240, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
    self.error_handler.check_response(response)
  File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: failed to lookup address information: Name does not resolve

Python3.6 Selenium3.0.2 IE10 win7

生机勃勃开首认为是geckodriver的难题,于是在分化的geckodriver换到换去,firefox也试过差别的版本,可是并不曾缓和。百度了弹指间也并未有有关的难题。

1、用如下代码打不开IE浏览器,可是能开垦火狐浏览器
import unittest
import os
from selenium import webdriver

最终依旧看错误消息,failed to lookup address information: Name does not resolve,

class TestAutoMethods(unittest.TestCase):
#打开Firefox浏览器
def test_openbrower:
browser = webdriver.Firefox()
browser.get("")

启动geckodriver的时候1508740937900    geckodriver    INFO    Listening on 127.0.0.1:4444

def test_FirstVase: #ie_driver = os.path.abspath(r"C:Program FilesInternet ExplorerIEDriverServer.exe") #os.environ["webdriver.ie.driver"] = ie_driver browser = webdriver.Ie() browser.get("http://www.youdao.com")

想到会不会是/etc/hosts的主题材料,于是在/etc/hosts上增多

if name == '__main__':
unittest.main()
2、报错音信
复制代码
Error
Traceback (most recent call last):
File "D:UserschenlePycharmProjectsuntitledtestFirstExam.py", line 14, in test_FirstVase
browser = webdriver.Ie()
File "C:Program FilesPython36libsite-packagesseleniumwebdriveriewebdriver.py", line 57, in init
desired_capabilities=capabilities)
File "C:Program FilesPython36libsite-packagesseleniumwebdriverremotewebdriver.py", line 92, in init
self.start_session(desired_capabilities, browser_profile)
File "C:Program FilesPython36libsite-packagesseleniumwebdriverremotewebdriver.py", line 179, in start_session
response = self.execute(Command.NEW_SESSION, capabilities)
File "C:Program FilesPython36libsite-packagesseleniumwebdriverremotewebdriver.py", line 234, in execute
response = self.command_executor.execute(driver_command, params)
File "C:Program FilesPython36libsite-packagesseleniumwebdriverremoteremote_connection.py", line 408, in execute
return self._request(command_info[0], url, body=data)
File "C:Program FilesPython36libsite-packagesseleniumwebdriverremoteremote_connection.py", line 478, in _request
resp = opener.open(request, timeout=self._timeout)
File "C:Program FilesPython36liburllibrequest.py", line 526, in open
response = self._open(req, data)
File "C:Program FilesPython36liburllibrequest.py", line 544, in _open
'_open', req)
File "C:Program FilesPython36liburllibrequest.py", line 504, in _call_chain
result = func
File "C:Program FilesPython36liburllibrequest.py", line 1346, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:Program FilesPython36liburllibrequest.py", line 1321, in do_open
r = h.getresponse()
File "C:Program FilesPython36libhttpclient.py", line 1331, in getresponse
response.begin()
File "C:Program FilesPython36libhttpclient.py", line 297, in begin
version, status, reason = self._read_status()
File "C:Program FilesPython36libhttpclient.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

127.0.0.1   localhost

难点消除。

 

本文由新葡萄京娱乐场8522发布于计算机编程,转载请注明出处:geckodriver的一次坑,求大神解答

TAG标签:
Ctrl+D 将本页面保存为书签,全面了解最新资讯,方便快捷。