Appium option should allow to attach the currently running process based on the Process ID
This is a feature request.
This will attach the currently running process to session without using Root session
var processes = Process.GetProcesses();
bool exi = false;
foreach (var process in processes)
{
string v = "";
try
{
v = process.MainModule.FileName;
}
catch { }
if (v.ToUpper() == ApplicationPath.ToUpper())
{
WindowHandle = process.MainWindowHandle.ToString("x");
exi = true;
break;
}
}
//////////
AppiumOptions Prop = new AppiumOptions();
Prop.AddAdditionalCapability("appTopLevelWindow", WindowHandle);
Prop.AddAdditionalCapability("deviceName", "WindowsPC");
Prop.AddAdditionalCapability("platformName", "Windows");
Session = new WindowsDriver<WindowsElement>(new Uri(@"http://localhost:4723/"), Prop);
Thanks very much for the answer, I didn't know it was a possibility.
@naeemakram you can use next method https://github.com/microsoft/WinAppDriver/issues/534#issuecomment-562030077
@naeemakram you can use next method #534 (comment)
Thanks for the tip
Process.GetProcesses() is working on local machine. how can we get processes in remote machine ? via remote WinAppDriver, I start an application, the application has a separate dialog. from Inspect, it is independent from the main session but has the same pid. my problem is how to get a windows handle for that dialog. windAppDriver.WindowHandles only give me the main windows.
thanks and regards
Yes it is not possible to get Window handle from a remote machine. If any one can give suggestion to get WindowsHandle from a remote machine will be very helpful.
Most helpful comment
This will attach the currently running process to session without using Root session
var processes = Process.GetProcesses();
bool exi = false;
foreach (var process in processes)
{