跳至内容
菜单
此问题已终结
1 回复
2093 查看

hello, i have the next problem, when run the webdriver in odoo, and load a webpage (WebB), then  i see this error



File "/odoo/odoo-server/addons/om_abatartrucks/models/crm.py", line 291, in calcula_distancia
    driver.get(webB)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 319, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/remote_connection.py", line 374, in execute
    return self._request(command_info[0], url, body=data)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/remote_connection.py", line 402, in _request
    resp = http.request(method, url, body=body, headers=headers)
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 70, in request
    **urlopen_kw)
  File "/usr/lib/python3/dist-packages/urllib3/request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/poolmanager.py", line 322, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "", line 3, in raise_from
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1377, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))



what can do?

Thanks

形象
丢弃

Odoo is just a web app, you should provide more info if you want any assist, how do you run your selenium tests ? And you are using a non official addon "om_abatartrucks" in your environment. It is better to remove all unofficial before reporting an issue with odoo

编写者 最佳答案

made a answer for extend the info:

The case its that i have a code , wich when i run out of odoo works perfect:


from selenium import webdriver

from https://www.google.com.ar/maps/dir/"

​webB=webA+a+"/"+b+"/"

​driver = webdriver.Chrome(options=chrome_options)

​driver.get(webB)


​time.sleep(5)


​try:

​accept_cookies = driver.find_element(by=By.XPATH, value="//button[@jsan='0.aria-checked,0.role']")

​accept_cookies.click()

​time.sleep(2)

​except:

​pass

​print("a:", a)

​print("b:", b)

​print("WEB:", webB)

​pagina = str(soup(driver.page_source, 'html.parser'))



​driver.close()

​txtinicio_min="class=\"XdKEzd\">"

​txtfin_min=""

​txt_inicio2="\">"

​inicio=pagina.find(txtinicio_min)

​txtrecort_min=pagina[inicio+len(txtinicio_min):]

​mintxt=txtrecort_min[txtrecort_min.find(txt_inicio2)+len(txt_inicio2):txtrecort_min.find(txtfin_min)]

​print("minutos:", Tomas(mintxt))

​try:

​if mintxt.find("h")

​tiempo=round(2*(int(mintxt[:2])/60), 2)

​print(tiempo)

​else:

​if mintxt.find("min")

​tiempo=round(2*int(mintxt[:mintxt.find("h")]), 2)

​else:

​tiempo=round(2*(int(mintxt[:mintxt.find("h")])+int(mintxt[mintxt.find("h")+2:mintxt.find("min")-1])/60), 2)

​except:

​tiempo=0.2


​print(tiempo)


​return tiempo


ORIGEN="Belgrano, CABA"

DESTINO="Villa Urquiza, CABA"


print(LecturaDirec(ORIGEN,DESTINO))


But, when i put this in odoo start to fail, raise a lot of errors, my principal answer its about how run a web and print the "str(soup(driver.page_source, 'html.parser'))" line



形象
丢弃
相关帖文 回复 查看 活动
1
1月 24
875
0
11月 23
898
1
8月 15
2708
0
2月 25
338
2
12月 24
2833