[英]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.