You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, first thanks for your effort with this project it really seems like I can optimize my UI tests with it. Second, I'm trying to test sample MAUI app and unfortunately my basic test is failing on Windows, but running fine on Android and I'm yet to try iOS.
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, Dictionary`2 parameters)
AppiumDriver`1.Execute(String driverCommandToExecute, Dictionary`2 parameters)
RemoteWebDriver.FindElement(String mechanism, String value)
RemoteWebDriver.FindElementByXPath(String xpath)
<>c__DisplayClass19_0.<XPath>b__0(ISearchContext context)
By.FindElement(ISearchContext context)
RemoteWebDriver.FindElement(By by)
<>c__DisplayClass32_0.<AttemptWaitForDriverElement>b__0(IWebDriver driver)
DefaultWait`1.Until[TResult](Func`2 condition)
BasePage.AttemptWaitForDriverElement(By locator, TimeSpan timeout, IWebDriver appDriver)
BasePage.VerifyPageShown(Nullable`1 timeout)
BasePage.ctor(RemoteWebDriver app, Nullable`1 traitTimeout)
BasePage.ctor()
MainPageBase.ctor()
WinMainPage.ctor()
MainPageTest.ctor(UiTestFixture fixtureBase) line 9
I've looked at the samples and figured I have to use different methods for constructing the test page depending on a platform, so I did this
public class MainPage : MainPageBase
{
protected override By GetBy(string id) => By.Id(id);
protected override IWebElement GetElement(string id) => FindElement(By.Id(id));
}
public class WinMainPage : MainPageBase
{
protected override By GetBy(string id) => WindowsByExtras.AutomationId(id);
protected override IWebElement GetElement(string id) => this.WindowsApp.FindElement(GetBy(id));
}
public abstract class MainPageBase : BasePage
{
protected override By Trait => GetBy("MainPage");
public IWebElement Button => GetElement("button");
protected abstract By GetBy(string id);
protected abstract IWebElement GetElement(string id) ;
}
What is the expected behavior?
Test is able to discover an element using its AutomationId across multiple platforms using a single method e.g. By.Id(automationId)
Hey @anpin, thanks for taking a look at Legerity (and apologies for replying to this SO late! 🤦
I'll take a look into this. I've not tested Legerity with MAUI yet, I've only validated it with Xamarin applications. I have a feeling that MAUI is using WinUI3 for Windows apps and this may not be supported by the WinAppDriver yet.
I'll validate this assumption and get back to you!
Describe the bug
Hi, first thanks for your effort with this project it really seems like I can optimize my UI tests with it. Second, I'm trying to test sample MAUI app and unfortunately my basic test is failing on Windows, but running fine on Android and I'm yet to try iOS.
I've looked at the samples and figured I have to use different methods for constructing the test page depending on a platform, so I did this
What is the expected behavior?
Test is able to discover an element using its AutomationId across multiple platforms using a single method e.g.
By.Id(automationId)
Package
No response
Other information
You can find repro here https://github.com/anpin/maui_ui_tests
The text was updated successfully, but these errors were encountered: