I request an example sample of Java.
I request an example sample of Java.
I'd especially like to know a sample of Java examples that to switch each other applications.
There is a dearth of examples in Java.
Have you will update plan for java
We're more than happy to take any community submissions here and merge them in. If anyone wants to contribute, please submit a PR!
Hi @YeonwooJeong I have worked with Java and can help you with example. Please provide a little more explanation for your requirement
@birarroshan hi I have an issue related to this. https://github.com/microsoft/WinAppDriver/issues/886 https://github.com/microsoft/WinAppDriver/issues/870
Thanks for your answer. can you help me?
@YeonwooJeong Here's the Java example
private static WindowsDriver desktopSession=null; private static WindowsDriver edgeSession=null; //switch to desktop/root Session appCapabilities.setCapability("app", "Root"); desktopSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), appCapabilities);
//getting the native window handle of app to switch to String NativeWindowHandle=desktopSession.findElementByName("xyz"); //name of the app you wish to switch to int natWinHandleInt = Integer.parseInt(NativeWindowHandle); String natWinHandleStr = Integer.toHexString(natWinHandleInt); String handle="0x"+natWinHandleStr;
//switching to different app appCapabilities.setCapability("appTopLevelWindow", handle); edgeSession=new WindowsDriver(new URL("http://127.0.0.1:4723"), appCapabilities);
//do stuff with the new app
Hope that helps!!
@YeonwooJeong Here's the Java example
private static WindowsDriver desktopSession=null; private static WindowsDriver edgeSession=null; //switch to desktop/root Session appCapabilities.setCapability("app", "Root"); desktopSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), appCapabilities);
//getting the native window handle of app to switch to String NativeWindowHandle=desktopSession.findElementByName("xyz"); //name of the app you wish to switch to int natWinHandleInt = Integer.parseInt(NativeWindowHandle); String natWinHandleStr = Integer.toHexString(natWinHandleInt); String handle="0x"+natWinHandleStr;
//switching to different app appCapabilities.setCapability("appTopLevelWindow", handle); edgeSession=new WindowsDriver(new URL("http://127.0.0.1:4723"), appCapabilities);
//do stuff with the new app
Hope that helps!!
I just saw your answer. But I still haven't solved the problem.
Specific explanations are needed for each code. I don't even know why there is an error in the variable. can you check my video?
https://user-images.githubusercontent.com/8816386/139401545-5efbc455-1af9-41e4-8bf5-49787ea592e8.mp4