I have powershell script that automate some tasks I am doing.
We are using Citrix and in order to get to an app in Citrix I am using Selenium.
The main problem in Citrix is that I can only use SendKeys to automate within the app after Selenium clicked it because I actually see a "Remote" UI.
My Code:
Add-Type -AssemblyName System.Windows.Forms
Start-Sleep -Seconds 5
[System.Windows.Forms.SendKeys]::SendWait(" ") ## Space to focus on item
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}") ## Enter to get into Printer Settings UI
Start-Sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait("%") ## ALT to focus on the menu
Start-Sleep -Seconds 1
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}") ## Enter to open the menu
I am loading System.Windows.Forms with Add-Type,
and using [System.Windows.Forms.SendKeys]::SendWait() to SendKeys.
I am using "Space" (" ") to focus and "{Enter}" to enter Settings UI, that's working..
But within the new settings UI window I can't seems to press "ALT" using the SendKeys to navigate to the menu and open it.
What weird about this problem is:
The window that opened the settings UI react properly to the SendKeys.
When I am not using SendKeys within the settings UI, but rather I click the ALT on the keyboard, the settings UI reacts properly to me smashing my keyboard...
The ALT sendkey works, because the ALT reacts fine when on Notepad or other application.
Thanks!
I tried to use VBA AppActivate, no success.
There is a problem using [System.Windows.Forms.SendKeys] class with Citrix, because Citrix terminal server can't handle special tabs using the SendKeys.
The solution is to download AutoIT and take out the .dll files (3 files).
Then load it to your C# code or to the Powershell and use it.
AutoIT sendkeys seems to interact just fine with citrix terminal servers and your automation can work fine with the sendkeys.
Related
I am trying to automate a scenario where I am trying to import a file from my local machine to my application. I am doing the import using the SendKeys method but the issue is that
while importing I have to click on the import button as it triggers the user authentication event. But doing so is also opening up the File Explorer dialog in the background which I do not know how to close. Is there a way to close the explorer? AutoIt is not supported by my framework as I am using.NetCore.
Found the solution.
This can be done by using the Process class provided by C#.
I have several Run configuration's in PyCharm:
one is for celery
second is for restarting rabbit
third is for main script run
Do not ask me why I need these configurations, I just want to use 3 shortcuts to run three Run configuration's separately.
So I decided to create macros for each one. But macro does not record choosing specific Run configuration.
Any ideas?
Macro
Open the run configurations menu (F10 in my setup)
Type the name of the config to run
Press enter
Bug on Mac OS
Not sure who could be impacted, but I ran into an annoying bug on the old macbook I'm hanging on to: Pycharm correctly receives each key at recording time (as can be seen in the macro window). But when replaying, instead of inputing the chars it seems to 'type' using my keyboard layout (BÉPO, french), using QWERTY locations !
Workaround:
Switch your computer to QWERTY
Run the macro recording
Type the config name as with your usual keyboard
Press enter (although the run config window will probably no longer be showing anything)
Stop recording
Switch back to your usual keyboard
For my example, my working macro is saying Typing: "ka;iqrc" !
I've created plugin to be able to use shortcuts to execute Run/Debug Configurations: Run Configuration as Action.
After loading of this plugin it register all Run/Debug configurations as actions. So you can assign shortcut for them, add them to toolbars, etc.
It works for all Jetbrains IDEs based on IntelliJ platform: CLion, PyCharm, PhpStorm, etc.
I have an application that is generally run on a scheduled task. However I also have a shortcut on the desktop to run the application there and then. I am wanting a message box to pop up when the user double clicks on to the shortcut, but NOT on the scheduled task.
Just add a command line argument to the shortcut and then check for the argument when your application starts, if found you are running from the desktop.
I am using selenium to record some tests. We have a save to pdf button on our application that generates the windows open/ save or in firefox the ok/cancel windows pop up,
The issue is that i can;t get selenium to record my ok or cancel action since i think it is not a javascript window?
Does anyone know the command to do that?
thanks
Sadly, it's not possible to interact with such windows at the moment.
A good workaround for saving files dialog is to save the various parameters (local directory, etc) and tell your browser to not prompt for them, so the window won't pop at all.
See http://wiki.openqa.org/display/SEL/Selenium+Core+FAQ#SeleniumCoreFAQ-Whatyoucan%27tdowithSelenium
Create a separate firefox profile(command to open profile manager:-firefox -P) with the settings you want(you can give settings like where to download and save a file of a particular type automatically without prompting) and instruct your server to use that profile using the command : java -jar 'your server ' -firefoxProfileTemplate 'path_for_firefox_profile'
I wrote test case to click on download button. How to go to download confirmation pop up window and select save or open option, and click ok and come back to main window. I am using selenium-python script for web test automation.
Selenium can't control the download confirmation. It can, however, type a file path directly in to the file upload field if you're using a "privileged" browser mode for IE or Firefox. If you're using the default *iexplore and *firefox modes with Selenium RC 1.0 beta 2, try simply type a file path directly in to the form field. I do this myself and it works great.
I think this question has been answered here before and the answer is using another tool for automating the browser's dialog e.g. autoit
How do we download a file by using Selenium?
you can switch the on the Pop-Up and confirm it, but I don't know to manage if....
Try that:
alert = browser.switch_to_alert()#switch to popup
alert.accept()#accept popup