Open vikrampvr opened 6 years ago
@vikrampvr I am doing like this if that helps...Here is my click wrapper implementation
do
{
WebElement element = ((WindowsDriver) webDriver).findElement(by, using);
try {
if ( element != null ) {
element.click();
Thread.sleep(500);
return;
}
} catch (Exception e) {
logger.debug("Couldnt find element using byType " +by + " locator " + using + " because of exception" + e.getMessage());
attempt++;
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
logger.debug("Exception while sleeping " + e.getMessage());
}
}
} while (attempt < 5 );
throw new WebDriverException("Couldnt find element using byType " +by + " locator " + using );
Hi @shankarkc , Can you open a ticket on the appium-dotnet-driver issue page here. They will be better able to assist you on this, as this appears to be outside WinAppDriver's scope.
@vikrampvr - here's how I accomplished this in C# for a login workflow scenario. After you login the code waits for the main window...
loginWindow.FindElementByAccessibilityId("Submit").Click();
var wait = new DefaultWait<WindowsDriver<WindowsElement>>(_session)
{
Timeout = TimeSpan.FromSeconds(60),
PollingInterval = TimeSpan.FromSeconds(1)
};
wait.IgnoreExceptionTypes(typeof(InvalidOperationException));
WindowsElement mainWindow = null;
wait.Until(driver =>
{
driver.SwitchTo().Window(driver.WindowHandles[0]);
mainWindow = driver.FindElementByAccessibilityId("MainWindow");
return mainWindow != null;
});
...not sure if this is best approach, but it works better than Thread.Sleep() IMHO since I cannot control how long it might actually take for the login process to complete and the main window to finally open.
Thanks @shankarkc and @brett-burkhart As suggested by @hassanuz i have been following the dotnet driver development in Appium. And there seem to be issues in implementing implicit wait and page loads....seems like they are still working on it. Also implementing PageObjects in appium with C# seems to be having many issues. Not sure if anyone using WinAppdriver tried to implement page objects.
I'm facing the same issue, any news on that?
Hi @aloula.,
This seems to be an issue with the appium dotnet driver bindings - we encourage you to open a new issue here, so that they have visibility into this.
Thanks
Hi @aloula.,
This seems to be an issue with the appium dotnet driver bindings - we encourage you to open a new issue here, so that they have visibility into this.
Thanks
Thanks @hassanuz
Can someone provide an example of a dynamic wait in WinAppDriver using java?
Facing below error : (unable to wait for element in opened window after app launch by entering login credentials with load spinner).
Error mesg : **org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters**
Tried waits as below but nothing worked : 1)WebDriverWait wait = new WebDriverWait(session,40); wait.until(ExpectedConditions.visibilityOf(session.findElementById("2A.5116A.4.B.F00D.1")));
2) session= new WindowsDriver
session.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
3)capabilities properties : cap.setCapability("ms:waitForAppLaunch", "25");
Hi !!
I have been trying to implement dynamic wait as below with no success.
WebDriverWait wait = new WebDriverWait(session, TimeSpan.FromSeconds(maxWaitTimeInSeconds)); wait.Until(ExpectedConditions.ElementExists(By.Name("something")));
The problem here is it seems like the "By" locator is not implemented in WinAppDriver which is present in "OpenQA.Selenium" namespace. without which im not sure how to implement explicit wait using WinAppDriver.
The below code works since we are passing the element to it and not the locator but the below condition is only if the element is already present and it just wait for the element to be enabled.
WebDriverWait wait = new WebDriverWait(session, TimeSpan.FromSeconds(maxWaitTimeInSeconds)); wait.Until(ExpectedConditions.ElementToBeClickable(element));
Is there anything i am missing here or is this still something to be implemented in WinAppDriver.