用chromedriver测试ubuntu 16.04上的硒

问题描述 投票:0回答:1

我在UBUNTU 16.04

当我运行此测试时:

sudo java -jar SeleniumTest.jar Driver Chrome Import Accounts.xml BaseUrl https://URL

输出:

Dec 15, 2017 3:46:22 AM com.company.vip.core.CoreManager main
INFO: Detected OS is : Linux
Dec 15, 2017 3:46:22 AM com.company.vip.core.CoreManager main
INFO: Loading App Config Data
Dec 15, 2017 3:46:22 AM com.company.vip.core.CoreManager main
INFO: App Configuration loaded Successfully
Dec 15, 2017 3:46:22 AM com.company.vip.core.CoreManager main
INFO: Starting Test Automation ...
Dec 15, 2017 3:46:22 AM com.company.vip.core.CoreManager main
INFO: Running All Tests
Dec 15, 2017 3:46:22 AM com.company.vip.core.CoreManager main
INFO: Starting Test Cases ...
[TestNG] Running:
  /opt/old/VIP2/testresources/Login.xml

Dec 15, 2017 3:46:22 AM com.company.vip.tests.Login.LoginSuite BeforeSuiteMethod
SEVERE: Chrome driver path is either unreadable or unassigned. Please configure your AppConfig.xml
Dec 15, 2017 3:46:22 AM com.company.vip.tests.Login.Login TestInvalidUserLogin
INFO: Starting TestInvalidUserLogin
Dec 15, 2017 3:46:22 AM com.company.vip.tests.Login.LoginSuite AfterMethod
SEVERE: Test Case : Login.TestInvalidUserLogin()[pri:0, instance:com.company.vip.tests.Login.Login@17579e0f] Failed
Dec 15, 2017 3:46:22 AM com.company.vip.tests.Login.Login TestValidUserLogin
INFO: Starting TestValidUserLogin
Dec 15, 2017 3:46:22 AM com.ilerra.vip.tests.Login.LoginSuite AfterMethod
SEVERE: Test Case : Login.TestValidUserLogin()[pri:0, instance:com.company.vip.tests.Login.Login@17579e0f] Failed
Dec 15, 2017 3:46:22 AM com.company.vip.tests.Login.LoginSuite AfterMethod
SEVERE: Test Case : SignUp.TestUserSignUp()[pri:0, instance:com.company.vip.tests.Login.SignUp@34cd072c] Failed

===============================================
LoginSuite
Total tests run: 3, Failures: 3, Skips: 0
Configuration Failures: 1, Skips: 0
===============================================

[TestNG] Running:
  /opt/old/VIP2/TestNG.xml


===============================================
allSuites
Total tests run: 3, Failures: 3, Skips: 0
Configuration Failures: 1, Skips: 0
===============================================

Xvfb stopping
Finished: SUCCESS

Appconfig.xml的内容:

<?xml version="1.0" encoding="UTF-8"?>
<AppConfig>
    <Environment>Staging</Environment>
    <ChromePath>/usr/local/bin/chromedriver</ChromePath>
    <ChromeProfile>/home/usr/.config/google-chrome/Default/</ChromeProfile>
    <ChromeIsHeadless>1</ChromeIsHeadless>
    <ImportParamsFrom>App</ImportParamsFrom>
</AppConfig>

~

selenium ubuntu testng selenium-chromedriver
1个回答
0
投票

经过多次尝试和故障排除,我发现:

1-你应该和普通用户一起运行测试(如果用root用户启动它会与chrome相关的东西会失败)2你必须对chromedriver 3-拥有ax权限你必须在Appconfig.xml文件上传递所有参数,如完全传递给镀铬和铬合金型材

© www.soinside.com 2019 - 2024. All rights reserved.