I am new to Appium test automation. I am automating power point windows desktop application.
I am facing exception while trying to click on slide and enter text. Following is the test and exception details.
Please help me to resolve this issue.
Test:
public WindowsDriver windowsDriverSession;
[SetUp]
public void Setup()
{
if (windowsDriverSession == null)
{
AppiumOptions opt = new AppiumOptions();
opt.AddAdditionalCapability("app", @"C:\Program Files\Microsoft Office\root\Office16\POWERPNT.EXE");
opt.AddAdditionalCapability("deviceName", "WindowsPC");
opt.AddAdditionalCapability("platformName", "Windows");
windowsDriverSession = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), opt);
Assert.IsNotNull(windowsDriverSession);
windowsDriverSession.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}
}
[Test]
public void AddTextToPowerPoint()
{
windowsDriverSession.FindElementByName("Blank Presentation").Click();
windowsDriverSession.FindElementByName("Insert").Click();
windowsDriverSession.FindElementByName("Home").Click();
windowsDriverSession.FindElementByAccessibilityId("1071").Click();
windowsDriverSession.FindElementByAccessibilityId("1071").SendKeys("This is slide title")
windowsDriverSession.FindElementByName("Subtitle TextBox").Click();
windowsDriverSession.FindElementByName("Subtitle TextBox").SendKeys("This is slide content");
}
[TearDown]
public void TestClose()
{
if (windowsDriverSession != null)
{
windowsDriverSession.Quit();
windowsDriverSession = null;
}
}
Note: I am getting exception in the above Test at this line (windowsDriverSession.FindElementByName(“Subtitle TextBox”).Click()
Exception:
Message:
OpenQA.Selenium.WebDriverException : An element could not be located on the page using the given search parameters.
Stack Trace:
RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) AppiumDriver
1.Execute(String driverCommandToExecute, Dictionary2 parameters) RemoteWebDriver.FindElement(String mechanism, String value) AppiumDriver
1.FindElementByName(String name)
Tests.AddTextToPowerPoint() line 39
Element details as below: