本文介绍了SessionNotCreatedException:消息:会话不是从选项卡创建的,使用 Odoo 在 Python 中崩溃了,但是 selenium 单独工作正常,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用与 odoo 13 集成的硒
执行代码:

I am using the selenium integrating with odoo 13
executing the code:

driver = webdriver.Chrome('/home/dev/chromedriver')

来自odoo.我认为与 odoo session 存在一些冲突.但是当我从一个单独的 python 文件中执行这段代码时,它运行良好.我还尝试在单击按钮时使用 Django 应用程序执行此代码.它运行良好,浏览器将打开.但是在odoo项目中它不起作用.我真的很困惑为什么它不起作用.

from odoo. I think there is some conflict with odoo session.But when I execute this code form a separate python file, it works well. I also tried to execute this code using Django application on a button click . It works well and browser will open. But in odoo project it won't work. I am really confused why it is not working.

Odoo Server Error
    Traceback (most recent call last):
      File "/home/dev/odoo13_home/odoo-13.0/odoo/http.py", line 619, in _handle_exception
        return super(JsonRequest, self)._handle_exception(exception)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/http.py", line 309, in _handle_exception
        raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
      File "/home/dev/odoo13_home/odoo-13.0/odoo/tools/pycompat.py", line 14, in reraise
        raise value
      File "/home/dev/odoo13_home/odoo-13.0/odoo/http.py", line 664, in dispatch
        result = self._call_function(**self.params)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/http.py", line 345, in _call_function
        return checked_call(self.db, *args, **kwargs)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/service/model.py", line 93, in wrapper
        return f(dbname, *args, **kwargs)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/http.py", line 338, in checked_call
        result = self.endpoint(*a, **kw)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/http.py", line 909, in __call__
        return self.method(*args, **kw)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/http.py", line 510, in response_wrap
        response = f(*args, **kw)
      File "/home/dev/odoo13_home/odoo-13.0/addons/web/controllers/main.py", line 1323, in call_button
        action = self._call_kw(model, method, args, kwargs)
      File "/home/dev/odoo13_home/odoo-13.0/addons/web/controllers/main.py", line 1311, in _call_kw
        return call_kw(request.env[model], method, args, kwargs)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/api.py", line 395, in call_kw
        result = _call_kw_multi(method, model, args, kwargs)
      File "/home/dev/odoo13_home/odoo-13.0/odoo/api.py", line 382, in _call_kw_multi
        result = method(recs, *args, **kwargs)
      File "/home/dev/odoo13_home/odoo-13.0/custom_modules_13/testing/models/models.py", line 28, in send_whatsapp_message
        driver = webdriver.Remote(service.service_url)
      File "/home/dev/odoo13_home/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 152, in __init__
        self.start_session(capabilities, browser_profile)
      File "/home/dev/odoo13_home/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 250, in start_session
        response = self.execute(Command.NEW_SESSION, parameters)
      File "/home/dev/odoo13_home/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 323, in execute
        self.error_handler.check_response(response)
      File "/home/dev/odoo13_home/venv/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 240, in check_response
        raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.SessionNotCreatedException: Message: session not created
    from tab crashed
      (Session info: chrome=80.0.3987.132)
    Stacktrace:
    #0 0x560acf67fd29 <unknown>

推荐答案

(Session info: chrome=80.0.3987.132)

您的 chrome 版本是 80.0.3987.132,请尝试下载 此 Chrome 网络驱动程序,将您的网络驱动程序文件夹添加到系统路径,然后重试.

Your chrome version is 80.0.3987.132,Try to download this Chrome webdriver,Add your webdriver folder to system PATH,and try again.

这篇关于SessionNotCreatedException:消息:会话不是从选项卡创建的,使用 Odoo 在 Python 中崩溃了,但是 selenium 单独工作正常,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 09:43