Package: rdp-manipulations
rdp-manipulationsTool for image-based control RDP (Remote Desktop Protocol). Manipulations, automations and testing via Python and Apache GuacamoleDemohttps://user-images.githubusercontent.com/710389/202258413-5c867a64-06d7-4cb5-8034-08523b114db4.mp4PrerequisitesInstalled and configuredApache Guacamole. I used this guacamole docker project:https://github.com/boschkundendienst/guacamole-docker-composeExamplessee./examplesfolder. To run it, clone this repo, and:poetry shell
poetry install
python examples/copy_and_zip.pySupported OSOnly Windows 7 is currently supported because I only needed to work with Windows 7 PCs. If you need support for other OSes, use yourASSERT_DICT, make a pull request, or write an issue. We'll figure something out.Table of ContentsmainASSERT_DICTRDP__init__loginkey_presskey_typemake_screenshotis_on_screenwait_until_appearwait_until_desappearexec_remotecopydircopymkdiropendirclosedirmouse_clickmouse_movemouse_move_tomouse_click_tocurrent_langlang_switchlogoutmainASSERT_DICTPass it to instance ofRDPfor unsupported OS (see below){
    'prelogin': './image_asserts/prelogin.png',
    'login': './image_asserts/login.png',
    'post_login': './image_asserts/post_login.png',
    'start_btn': './image_asserts/start_btn.png',
    'start_btn_selected': './image_asserts/start_btn_selected.png',
    'run_window': './image_asserts/run_window.png',
    'lang_ru': './image_asserts/lang_ru.png',
    'lang_en': './image_asserts/lang_en.png',
    'opened_folder': './image_asserts/opened_folder.png',
    'files_copy': './image_asserts/files_copy.png',
}RDP ObjectsclassRDP()RDP class__init__def__init__(headless=headless,width=width,height=height,clear_logs=clear_logs,assert_dict=ASSERT_DICT)->NoneArguments:headlessbool, optional- if False rdp window is shown.
(default is True)widthint, optional- witdth of rdp window. Set it same in guacamole
(default is 800)heightint, optional- witdth of rdp window. Set it same in guacamole
(default is 600)clear_logsbool, optional- if True old image logs will be removed when RDP class inited.
(default is True)assert_dictdict, optional- dict with assertion images. Pass it for unsupported OS
(default isASSERT_DICT)logindeflogin(guacamole_user:str,guacamole_password:str,guacamole_pc_name:str,guacamole_url=guacamole_url)->NoneLogin method. Call this firstkey_pressdefkey_press(keys:str)This is wrapper of playwright keyboard.press method. see:https://playwright.dev/python/docs/api/class-keyboard#keyboard-presskey_typedefkey_type(text:str)Type text on remote pcmake_screenshotdefmake_screenshot(filename:Optional[str]=None,path:Optional[str]=None)->strMake screenshot, and save it to default direcotry (./image_logs), or to given pathis_on_screendefis_on_screen(assertion:str,threshold:float=image_threshold)->boolChecking assertion image is on screen (assertion is a path to image)wait_until_appeardefwait_until_appear(assertion:str,attempts:int=screen_state_attempts,threshold:float=image_threshold)->NoneWaiting until assertion image is appear on screen (assertion is a path to image)wait_until_desappeardefwait_until_desappear(assertion:str,attempts:int=screen_state_attempts,threshold:float=image_threshold)->NoneWaiting until assertion image is desappear on screen (assertion is a path to image)exec_remotedefexec_remote(cmd_str:str)->NoneExecute remote command via win+r run windowcopydirdefcopydir(from_path:str,to_path:str)->NoneCopy folder on remote PCcopydefcopy(from_path:str,to_path:str)->NoneCopy file on remote PCmkdirdefmkdir(dir_path:str)->NoneMaking directoryopendirdefopendir(dir_path:str,local:bool=False)->NoneOpen explorer.exe of given directory pathclosedirdefclosedir(dir_name:str)->NoneClose explorer.exe of given directory namemouse_clickdefmouse_click(x:float,y:float,click_count:int=1)->NoneMouse left click on remote PC by giving coordinatesmouse_movedefmouse_move(x:float,y:float)->NoneMouse move on remote PC by giving coordinatesmouse_move_todefmouse_move_to(assertion:str)->Optional[tuple[float,float]]Mouse move on remote PC by giving image assertion pathmouse_click_todefmouse_click_to(assertion:str,button:Literal['left','middle','right']='left')->Optional[tuple[float,float]]Mouse click on remote PC by giving image assertion pathcurrent_langdefcurrent_lang()->Optional[str]Get a current keuboard language (now support only 'en' and 'ru')lang_switchdeflang_switch(lang:Optional[str]=None)->Optional[str]Switch keuboard language (now support only 'en' and 'ru')logoutdeflogout()->NoneLogout method