I am just starting with Automatization, but I have a problem with elements.
I have this XPath
"/Pane[@Name=\"Desktop 1\"][@ClassName=\"#32769\"]/Window[@AutomationId=\"win\"][@Name=\"COLOSSEO Show Manager 1.0.0.0 (64bit) .NET Framework 4.8.4250.0\"]/Custom[@ClassName=\"FooterView\"]/Custom[@ClassName=\"RadSplitButton\"]/Button[@AutomationId=\"ButtonPart\"][@Name=\"ButtonPart\"]/Text[@Name=\"STOP ACTIONS\"][@ClassName=\"Text\"]"
and my code is:
[TestClass]
public class UnitTest1
{
static WindowsDriver<WindowsElement> SessionApplications;
[ClassInitialize]
public static void BeforeTest(TestContext testContext)
{
AppiumOptions appiumOptions = new AppiumOptions();
appiumOptions.AddAdditionalCapability("app", @"C:\COLOSSEO\ShowManager\Colosseo.ShowManager.exe");
SessionApplications = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723/"), appiumOptions);
System.Threading.Thread.Sleep(1000);
}
[TestMethod]
public void TestMethod1()
{
SessionApplications.FindElementByName("Stop Action").Click();
But the Error is still the same:
Test Name: TestMethod1
Test FullName: UnitTestProject2.UnitTest1.TestMethod1
Test Source: C:\Users\renata.cikova\source\repos\UnitTestProject2\UnitTestProject2\UnitTest1.cs : line 25
Test Outcome: Failed
Test Duration: 0:00:00.1818331
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Appium.AppiumDriver1.Execute(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value) at OpenQA.Selenium.Appium.AppiumDriver1.FindElementByName(String name)
at UnitTestProject2.UnitTest1.TestMethod1() in C:\Users\renata.cikova\source\repos\UnitTestProject2\UnitTestProject2\UnitTest1.cs:line 27
Result Message:
Test method UnitTestProject2.UnitTest1.TestMethod1 threw exception:
OpenQA.Selenium.WebDriverException: An element could not be located on the page using the given search parameters.
I don't have any idea how to find the element. Could you help me?