I'm trying to automate a workflow with MS Teams and I'm using WinAppDriver. I'm able to bring up Teams and WinAppDriver using the following code

String command = "C:\\Program Files (x86)\\Windows Application Driver\\WinAppDriver.exe";
ProcessBuilder winappDriver = new ProcessBuilder(command).inheritIO();
DesiredCapabilities cap = new DesiredCapabilities();

But after starting up teams WinAppDriver cannot recognize the Add a Tab button with all the following functions

driver.findElementByName("Add a tab");
driver.findElementByXPath("//Button[@Name='Add a tab']");

This is the button I'm trying to click enter image description here

And this what the inspect tool is showing me for this button enter image description here

What am I doing wrong? Thank you!

  • I removed the statement cap.setCapability("app","C:\\Users\\Admin\\AppData\\Local\\Microsoft\\Teams\\current\\Teams.exe"); to start teams and replaced it with cap.setCapability("app", "Root"); I'm now automating by starting Teams from Search task bar. This seems to work for some reason
    – Ravi Teja
    Mar 13 at 13:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.