【问题标题】:C# UI Tests WinAppDriver Appium test color?C# UI 测试 WinAppDriver Appium 测试颜色?
【发布时间】:2019-03-22 00:10:53
【问题描述】:

目前正在测试我们最近添加到项目中的 Excel 插件窗格。我想测试“创建工作表”文本的颜色。

public void ConfirmBtnText()
    {
        excelSession.FindElementByName("Home").Click();
        excelSession.FindElementByXPath("//Button[@Name='AddIn button']").Click();

        var getLabel = excelSession.FindElementByName("Create worksheet");
        Assert.AreEqual("Create worksheet", getLabel.Text);

        Assert.AreEqual("rgb(75, 79, 84)", getLabel.GetAttribute("Color")); // Fails here
    }

错误提示:

预期:rgb(75, 79, 84)。实际:.

我应该如何在 Excel 插件窗格中测试元素的颜色?

感谢您的帮助。

这也失败了:

string cssProperty = getLabel.GetCssValue("Color");

出现错误:

OpenQA.Selenium.WebDriverException:意外错误。命令未实现:GET:/session/0CEE6663-DCBA-44E3-AC75-A7A5AF97DECA/element/42.525736.4.12/css/Color

【问题讨论】:

  • 读到 Appium 不支持这种东西?

标签: c# excel appium coded-ui-tests winappdriver


【解决方案1】:

编码的 UI 不提供对颜色属性的任何访问。一种解决方案是增强应用程序,以便在设置颜色的同时设置编码 UI 可以看到的属性。另一种方法是使用相关 UI 控件的CaptureImage 方法,然后测试保存的图像中的颜色。

【讨论】:

  • 一种解决方案是增强应用程序,使其在设置颜色的同时设置编码 UI 可以看到的属性。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-05
  • 1970-01-01
  • 2014-08-03
  • 1970-01-01
  • 2020-05-07
  • 2016-11-02
相关资源
最近更新 更多