Need a way to remove the app from recent applist - testcomplete

I have scenario where I need to remove the tested App from recent App list in Android.
Issue is I am not able to click on recent App button using TC.
Is there any way where we can acomplish this using TC script.
Thanks
Suvidh

You can do this using this code:
var dvcName = "...";
var pckgName = "...";
Mobile.Device(dvcName).ShellExecute("adb shell pm uninstall " + pckgName);

Related

SendKeys for Xamarin.Mac

I am building a Mac app in Xamarin and have a need to send keystrokes (with words and phrases) to other applications. Something like SendKeys in .Net on Windows.
Is there a SendKeys equivalent API for Mac in Xamarin?
CGEventCreateKeyboardEvent is what you are looking for, it is Quartz-based and thus a low-level C API.
Xamarin has a shim-wrapper over it via an CGEvent .ctor. After you create the event, include any-keyboard modifiers (shift/apple/alt/....), you can Post it to a process id of your choosing.
Really quick example that sends stackoverflow to active process/window.
using (var eventSource = new CGEventSource(CGEventSourceStateID.HidSystem))
{
var eventString = "StackOverflow";
foreach (var eventChar in eventString)
{
// 🍣 my most favorite Enum.Parse line ever written 🍣
var key = (ushort)(NSKey)Enum.Parse(typeof(NSKey), eventChar.ToString().ToUpper());
using (var keyEvent = new CGEvent(eventSource, key, true))
{
CGEvent.Post(keyEvent, CGEventTapLocation.HID);
}
}
}
Note: To see it in action, place a Task.Delay before it, run it and then switch to/activate an editor, maybe Visual Studio for Mac :-) and let it type into the active editor panel.
FYI: You might want to refer to the Xamarin wrapper/source code for CGEvent.cs, as their naming is not vary ObjC or Swift friendly in terms of be able from translate Apple docs to Xamarin.Mac code.
Re: xamarin-macios/src/CoreGraphics/CGEvent.cs

UWP FolderPicker Select Folder button disabled by default?

I have a simple code for FolderPicker:
var diagFolder = new FolderPicker();
diagFolder.FileTypeFilter.Add("*");
var outputFolder = await diagFolder.PickSingleFolderAsync();
if (outputFolder == null) { return; }
It works well on first launch. However, upon second call, the Select Folder button is disabled and user cannot choose the same folder although it is perfectly valid. I have to go back a level and re-enter the folder if I want to pick that same folder.
Anyone is having this problem and know a fix for it?
EDIT: as of my guess, it is not actually UWP code problem, but Windows problem, so I posted a feedback here: https://aka.ms/AA1hloz . I think voting there should help.

Is there a better way to handle the path to the .app file when testing React Native apps using Appium?

I'm just getting my feet wet testing React Native apps and I was wondering whether there was an easier way to path to the app in the appium.txt file. That file looks like this:
[caps]
platformName = "ios"
deviceName = "iPhone 6"
platformVersion = "9.2"
waitForAppScript = true
app = "Library/Developer/CoreSimulator/Devices/923C1612-25BA-4206-9109-5C0B65B08897/data/Containers/Bundle/Application/B91B9D4B-5A95-4576-86D5-94060F7F3680/myapp.app"
[appium_lib]
sauce_username = false
sauce_access_key = false
the app = portion handles the path to the actual app file that appium will run my test suite against (I'm current using cucumber and watir-webdriver) but the problem is that every time I run that app from Xcode, the app UDID changes. Is there a better way to do this? Any help is appreciated.
Setting relative path in app=.../.../YOUR_PATH_TO_THE_APP/YOUR_APP.app
will do the trick. It will take the app from that location and fire it up.
No need to bother with XCode builds.
Please see here example:

WebDriver / stuck when open upload file window

I use my WebDriver, with FireFox.
I have an elemnt: //input[#class="uploadFiles"], when I click on it by:
driver.findElement(By.xpath("//input[#class="uploadFiles"]")), a windows of upload a file (Windows OS's window) is opened, but the test doesn't continue to the next line, and get stuck.
Any help?
Webdriver doesnt interact with os level dialogs and that's the reason it doesnt continue to the next line. Here's something to help you : http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions#Q:_Does_WebDriver_support_file_uploads?
No you cant do it with WebDriver as niharika_neo answer but you can do next:
string filepath = "my local path";
_driver.FindElement(By.Id("attachments")).SendKeys(filepath);
_driver.FindElement(By.Id("attachments")).SendKeys(Keys.Return);
You can't interact with OS level Windows directly. You can go through the path given by niharika_neo or else you can use Auto IT tool for handling the OS level windows. The best option is to use Auto IT tool.
I faced the same problem with FF, then I found that it was specific to the FF version I am using. I installed and ran the tests on FF 11, and I was able to successfully runt he tests. Try changing the version of FF that you are using.

TaskDialog default button

stackoverflow just works faster :)
I'm using the Windows® API Code Pack for Microsoft® .NET Framework to access Windows 7 API and I want to change my old MessageBox to TaskDialog.
One thing I cannot find is the default button of the dialog. Is there a way to set it? what about a work around?
thanks
There is a Default property on a control under the taskbased dialog you can set to true. From the sample (Samples\TaskDialogDemo\CS\TaskDialogDemo) that ships with it:
TaskDialog tdEnableDisable = new TaskDialog();
tdEnableDisable.Cancelable = true;
tdEnableDisable.Caption = "Enable/Disable Sample";
tdEnableDisable.InstructionText = "Click on the buttons to enable or disable the radiobutton.";
enableButton = new TaskDialogButton("enableButton", "Enable");
enableButton.Default = true;
enableButton.Click += new EventHandler(enableButton_Click);
If you run the demo, click Enable/Disable sample and then press Enter a few times you will see that the two buttons take turns being the default.

Resources