Anyone can use selenium or some thing similar in module odoo.
When i run selenium it return result normal but when i integration it in odoo module
i got error
selenium.common.exceptions.SessionNotCreatedException: Message: session not created
from tab crashed
here is my code
/*helper.py*/
from selenium import webdriver
from selenium.webdriver import Chrome
from time import sleep
from datetime import datetime
startTime = datetime.now()
def get_address(tax):
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
# open it, go to a website, and get results
driver = Chrome('chromedriver',options=options)
driver.get("https://dichvuthongtin.dkkd.gov.vn/inf/default.aspx")
driver.find_element_by_css_selector('#FrontPG-2').click()
driver.find_element_by_css_selector('#ctl00_C_RptProdGroups_ctl02_LiActiveProdGroup #LnkActiveProdGroup').click()
a = driver.find_element_by_css_selector("#ctl00_C_UC_ENT_LIST1_ENTERPRISE_GDT_CODEFilterFld")
a.click()
a.send_keys(tax)
driver.find_element_by_css_selector('#ctl00_C_UC_ENT_LIST1_BtnFilter').click()
sleep(0.5)
result = driver.find_element_by_css_selector('#ctl00_C_UC_ENT_LIST1_CtlList_ctl02_Cmd4').text
return result
/*einvoice_invoice.py*/
from odoo import models, fields, api
from . import helper
class ResPartner(models.Model):
_inherit = "einvoice.invoice"
@api.onchange('tax')
def _get_partner_info(self):
print("haha")
address = helper.get_address(self.tax)
print(address)
self.user_address= address
@koheso did you get any solution for this ? i had similar issue