Currently testing an Excel add in pane that we've recently added into our project. I'd like to test the color of the, "Create worksheet" text.
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
}
Error says:
Expected:rgb(75, 79, 84). Actual:<(null)>.
How should I go about testing colors of an element on the Excel add in pane?
Any help's appreciated, thanks.
This also fails:
string cssProperty = getLabel.GetCssValue("Color");
With the error:
OpenQA.Selenium.WebDriverException: Unexpected error. Command not implemented: GET: /session/0CEE6663-DCBA-44E3-AC75-A7A5AF97DECA/element/42.525736.4.12/css/Color
I used an appium screenshot function to solve this.
Kindly refer to this link for usage details: https://appium.io/docs/en/commands/session/screenshot/