How can I use EnumWindows to find windows with a specific caption/title?

Original Answer Use EnumWindows and enumerate through all the windows, using GetWindowText to get each window’s text, then filter it however you want. [DllImport(“user32.dll”, CharSet = CharSet.Unicode)] private static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount); [DllImport(“user32.dll”, CharSet = CharSet.Unicode)] private static extern int GetWindowTextLength(IntPtr hWnd); [DllImport(“user32.dll”)] private static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr … Read more

How to get webDriver to wait for page to load (C# Selenium project)

I’ve been searching for alternatives and I’ve settled for the following versions. All use explicit wait with a defined timeout and are based on element properties in the first case and on element staleness in the second case. First choice would be checking element properties until a timeout is reached. I’ve arrived to the following … Read more

How to get Bundle Id of your app iOS UIA automation

You’d use: [[NSBundle mainBundle] bundleIdentifier] + mainBundle “[r]eturns the NSBundle object that corresponds to the directory where the current application executable is located.” and hence will return an NSBundle object for the application bundle. [- bundleIdentifier] Returns “[t]he receiver’s bundle identifier, which is defined by the CFBundleIdentifier key in the bundle’s information property list.”

Changing Android Device orientation with ADB

Instead of using “adb shell content”, there’s a more clean way by using “adb shell settings”. They are doing the same thing, put value to settings provider. adb shell settings put system accelerometer_rotation 0 #disable auto-rotate adb shell settings put system user_rotation 3 #270° clockwise accelerometer_rotation: auto-rotation, 0 disable, 1 enable user_rotation: actual rotation, clockwise, … Read more

Get Current Activity in Espresso android

In Espresso, you can use ActivityLifecycleMonitorRegistry but it is not officially supported, so it may not work in future versions. Here is how it works: Activity getCurrentActivity() throws Throwable { getInstrumentation().waitForIdleSync(); final Activity[] activity = new Activity[1]; runTestOnUiThread(new Runnable() { @Override public void run() { java.util.Collection<Activity> activities = ActivityLifecycleMonitorRegistry.getInstance().getActivitiesInStage(Stage.RESUMED); activity[0] = Iterables.getOnlyElement(activities); }}); return activity[0]; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)