Open GauravDhameja opened 2 years ago
can you share what is shown in inspect.
@anunay1 I can't do that due to file restriction policy.
Do you want me to provide some info?
It will just be a screen shot, if you can't then I cannot support
What do you get in the console logs and also I need the UI tree in the inspect
Console Window
[RemoteTestNG] detected TestNG version 6.14.3 Windows 10 This is windows platform Nov 11, 2021 4:16:48 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0 INFO: Detected dialect: OSS FAILED: StartDefaultCalibration Launch LCS and Calibrate with default values java.lang.AssertionError: expected [true] but found [false] at org.testng.Assert.fail(Assert.java:96) at org.testng.Assert.failNotEquals(Assert.java:776) at org.testng.Assert.assertTrue(Assert.java:44) at org.testng.Assert.assertTrue(Assert.java:54) at tests.BaseClass.StartDefaultCalibration(BaseClass.java:217) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:583) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
I have called like this.
I am able to perform click operation on button using first statement, but for other button on a different page I am unable to perform click operation using third statement.
Sleep of 3 seconds is introduced as when we perform 1st statement operation it takes around 2 seconds to load the other window, where I want to perform Click operation using 3rd statement.
Not this console window please share the logs on WinAppDriver console window
Alos share the expanded UI tree in inspect
Parent of Next button is "CalibrationValidationWindow" window
- winDriver.findElementByAccessibilityId("CalibrationBtn").click();
- Thread.sleep(3000);
- winDriver.findElementByAccessibilityId("CalibrationWndNextBtn").click();
I have called like this.
I am able to perform click operation on button using first statement, but for other button on a different page I am unable to perform click operation using third statement.
Sleep of 3 seconds is introduced as when we perform 1st statement operation it takes around 2 seconds to load the other window, where I want to perform Click operation using 3rd statement.
Solution1: So your application has two windows, and you are trying to click the button on the second window, then you need to get the window handles first, switch to that window handle and then try to click the button
Solution 2: Create a root session, switch to the second windows using a fresh driver session, and then click the button on the second window page.
Did any of the solutions worked?
Tried first one, but after performing the first button click, other window opens. But windowHandle is still the same.
I have tried printing the value of windowHandle before click and after new window opens
What is the count of window handles, when the second window is opened, if t remains the same then try the second solution.
Thanks for the help.
It worked.
Initially when I tried calling getWindowHandle() API, I was getting the same window handle.
I tried calling getWindowHandles() API instead of getWindowHandle(). Then I got a different handle in a set of string.
After iterating through that set, found the first element and switch to that windowHandle.
then I was able to access the controls on that page.
Thanks Again
Great👍
@GauravDhameja somehow I cannot see you comments in the issue, but can see the comments in the mail. if the window handle is zero then most probably the new window is not a separate window, but part of the same window, you do not need to switch the window handle.
Hi all, I am unable to perform click operation on a button of my WPF application.
Any suggestions or solution in this regard would be very helpful.
Thanks in advance.