0

I have an automation project in C# that works with Microsoft Excel using WinAppDriver Release Candidate 1.2.

I have a case where I am attempting to get the number of rows that have been populated on a sheet with the code below.

    public string GetLastCellBelowStartRange(string sheetName, string startRange)
    {
        var sheet = FindSheet(sheetName);

        var nameBox = this.GetNameBox();
        nameBox.SendKeys($"{sheetName}!{startRange}{Keys.Enter}");

        this.excel.SendKeys($"{Keys.Control}{Keys.ArrowDown}");

        var endCellRange = nameBox.GetAttribute("LegacyIAccessible.Value");

        return endCellRange;
    }

The code successfully goes to the last cell in the workbook and nameBox is known as well as the excel driver (i.e. this.excel).

I cannot determine how to get the contents of the current cell which Inspect shows in both Value.Value and LegacyIAccessible.Value.

Does anybody know of a way to do this?

Lee Z
  • 802
  • 2
  • 13
  • 39

1 Answers1

0
public string GetLastCellBelowStartRange(string sheetName, string startRange)

    {
        var sheet = FindSheet(sheetName);

        var nameBox = this.GetNameBox();
        nameBox.SendKeys($"{sheetName}!{startRange}{Keys.Enter}");

        this.excel.SendKeys($"{Keys.Control}{Keys.ArrowDown}");

        string endCellRange = nameBox.GetAttribute("Value.Value").ToString();

        return endCellRange;
    }
Tree55Topz
  • 1,102
  • 4
  • 20
  • 51