【问题标题】:chrome browser is being launched eventhough firefox is configured as the browser in testng.xml即使在 testng.xml 中将 firefox 配置为浏览器,chrome 浏览器仍在启动
【发布时间】:2017-10-27 06:16:21
【问题描述】:

尝试在 chrome 和 firefox 中运行并行测试。在执行期间,正在启动另一个 chrome 浏览器而不是 firefox 浏览器,并且它被忽略了。以下是正在使用的文件版本 操作系统 - Ubuntu 16.04 LTS, 火狐版本 - 54, 壁虎版 - v0.18, Chrome版本-60.0.311, Chrome 驱动程序 - 2.53

testng.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="AutomationSuite" parallel="tests">
    <test name="TestCaratLaneInFireFox">
        <parameter name="node" value="http://*******:4444/wd/hub"/>
        <parameter name="browser" value="Firefox"/>
        <packages>
            <package name="script"/>
        </packages>
    </test>
    <test name="TestCaratLaneInChrome">
        <parameter name="node" value="http://****:4444/wd/hub"/>
        <parameter name="browser" value="chrome"/>
        <packages>
            <package name="script"/>
        </packages>
    </test>
</suite>

BaseTest.Java

public class BaseTest implements IAutoConst {

    public WebDriver driver;

    static {    
        System.setProperty(CHROME_KEY, CHROME_VALUE);
        System.setProperty(GECKO_KEY, GECKO_VALUE);
    }

    @Parameters({"node","browser"})
    @BeforeMethod
    public void openApplication(String node,String browser) throws MalformedURLException {

        // ChromeOptions options = new ChromeOptions();
        // options.addArguments("--disable-notifications"); 
        URL system = new URL(node);
        DesiredCapabilities whichBrowser = new DesiredCapabilities();
        whichBrowser.setBrowserName(browser);
        driver = new RemoteWebDriver(system,whichBrowser);
        driver.get(URL);        
        driver.manage().timeouts().implicitlyWait(ITO, TimeUnit.SECONDS);
        //driver.manage().window().maximize();
    }

    @AfterMethod
    public void closeApplication() {
        driver.close();
    }
}

可通过电子邮件发送的报告:

【问题讨论】:

  • 你在运行哪个测试?
  • 尝试并行运行两个测试。在包级别运行脚本。
  • 测试是否在远程机器上运行?还是在同一台机器上?
  • 测试在同一台机器上运行。
  • 我认为在同一台机器上进行浏览器测试的并行测试是不可能的。

标签: selenium selenium-webdriver selenium-grid2


【解决方案1】:

集线器中保存的 Gecko 驱动程序版本与节点中的版本不同。因此它阻止了 Firefox 的启动。

【讨论】:

  • 我不确定您是在添加评论还是在尝试回答自己的问题。如果您只是添加评论,请删除此答案。如果您尝试回答自己的问题,我建议您详细说明您的答案,以便最终可能会遇到您的问题的其他人获得足够的背景信息,以便他们也从答案中受益。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-13
  • 1970-01-01
  • 2011-01-20
  • 2020-11-22
  • 2021-04-23
相关资源
最近更新 更多