简体   繁体   English

Jenkins 云:Chrome 启动失败:异常退出

[英]Jenkins cloud : Chrome failed to start: exited abnormally

I have this code to run a simple automated test:我有这段代码来运行一个简单的自动化测试:

class AddToCartTest(unittest.TestCase):
direct = os.getcwd()
def setUp(self):
    if os.getenv('CHROMEWEBDRIVER'):
        chromewebdriverbin = os.getenv('CHROMEWEBDRIVER')
    else:
        chromewebdriverbin = '/usr/local/bin/chromedriver'
    self.driver = webdriver.Chrome(executable_path=chromewebdriverbin)
def test_add_to_cart_with_login(self):
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument('--no-sandbox')
    chrome_options.add_argument("--headless")
    chrome_options.add_argument("--disable-gpu")
    chrome_options.add_argument("--window-size=1920,1080")
    browser = webdriver.Chrome(options=chrome_options)
    browser.get('https://www.google.com')
    time.sleep(5)
    browser.quit()
if __name__ == '__main__':
unittest.main()

i have this config on Jenkins shell on my kenkins cloud:我在我的肯金斯云上的 Jenkins shell 上有这个配置:

export https_proxy=http://proxy.org:3128
export http_proxy=http://proxy.org:3128

And i import venv python3 -m venv venv source./venv/bin/activate I install PIP and Selenium and Allure report我导入 venv python3 -m venv venv source./venv/bin/activate 我安装 PIP 和 Selenium 和 Allure 报告

pip3 install --upgrade pip
pip3 install selenium
pip3 install allure-pytest
pip3 install -r requirements.txt
echo "Import chromedriver on the env variable."
export CHROMEWEBDRIVER=/usr/local/bin/chromedriver
echo "Import python path on the env variable."
export PYTHONPATH=.
python3 com/POMProject/Tests/Cart/test.py

I have solve it by updating chromedriver on jenkins who used old version我已经通过在使用旧版本的 jenkins 上更新 chromedriver 来解决它

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GitLab 的 CI/CD 管道:Selenium Chrome 驱动程序启动失败:异常退出或 google-chrome 不再运行,Chrome 已崩溃 - GitLab's CI/CD pipelines: Selenium Chrome driver failed to start: exited abnormally or google-chrome is no longer running, Chrome has crashed WebDriverException:消息:未知错误:Chrome 无法启动:异常退出。”(驱动程序信息:chromedriver=97)使用 Selenium Python - WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally." (Driver info: chromedriver=97) using Selenium Python 追溯(最近一次通话最近):selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome无法启动:异常退出 - Traceback (most recent call last): selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally 升级到Python 3.6后无法在启动时启动cloud-init - Failed to start cloud-init at startup after upgrading to Python 3.6 机器人框架 WebDriverException:消息:未知错误:Chrome 无法启动: - Robot framework WebDriverException: Message: unknown error: Chrome failed to start: Gunicorn 无法以 code=exited, status=203/EXEC 启动 - Gunicorn is failing to start with code=exited, status=203/EXEC 推断错误:外部错误:*** 捕获未能执行:以代码 65 退出 - Infer Error: External Error: *** capture failed to execute: exited with code 65 TimeoutError:工作程序无法启动 - TimeoutError: Worker failed to start 录像机 | 权限被拒绝错误:无法重现阶段:无法运行:.py,以 126 退出 - DVC | Permission denied ERROR: failed to reproduce stage: failed to run: .py, exited with 126 无法启动 kernel - VsCode 中的 Jupyter - Failed to start kernel - Jupyter in VsCode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM