1

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(&quot;app&quot;, @&quot;C:\COLOSSEO\ShowManager\Colosseo.ShowManager.exe&quot;);
        SessionApplications = new WindowsDriver&lt;WindowsElement&gt;(new Uri(&quot;http://127.0.0.1:4723/&quot;), appiumOptions);
        System.Threading.Thread.Sleep(1000);
    }


    [TestMethod]
    public void TestMethod1()
    {
        SessionApplications.FindElementByName(&quot;Stop Action&quot;).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?

Prome
  • 1,014
  • 9
  • 24
Renata Cikova
  • 11
  • 1
  • 2
  • Most probably people will not be able to see the error without the DOM tree you running your test against. Could you provide it? – João Farias Nov 23 '20 at 21:12

1 Answers1

1
Text[@Name=\"STOP ACTIONS\"]

FindElementByName("Stop Action")

I think you miss an S at the end. Also I think this search might be CASE SENSTIVE.

Niels van Reijmersdal
  • 32,520
  • 4
  • 57
  • 124