|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html class="writer-html5" lang="ru" >
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
|
|
|
|
|
|
<title>8. Как использовать? — документация pyOpenRPA v1.2.12 v1.2.12</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
|
|
|
|
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="shortcut icon" href="../_static/favicon.ico"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
|
<script src="../_static/js/html5shiv.min.js"></script>
|
|
|
|
|
<![endif]-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
|
|
|
|
<script src="../_static/jquery.js"></script>
|
|
|
|
|
<script src="../_static/underscore.js"></script>
|
|
|
|
|
<script src="../_static/doctools.js"></script>
|
|
|
|
|
<script src="../_static/translations.js"></script>
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="../_static/js/theme.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="index" title="Алфавитный указатель" href="../genindex.html" />
|
|
|
|
|
<link rel="search" title="Поиск" href="../search.html" />
|
|
|
|
|
<link rel="next" title="9. Зависимости" href="09_Dependencies.html" />
|
|
|
|
|
<link rel="prev" title="7. Image" href="07_image.html" />
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body class="wy-body-for-nav">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="wy-grid-for-nav">
|
|
|
|
|
|
|
|
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
|
|
|
|
<div class="wy-side-scroll">
|
|
|
|
|
<div class="wy-side-nav-search" >
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="../index.html" class="icon icon-home"> pyOpenRPA v1.2.12
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="search">
|
|
|
|
|
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
|
|
|
|
|
<input type="text" name="q" placeholder="Поиск в документации" />
|
|
|
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
|
|
|
<input type="hidden" name="area" value="default" />
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p class="caption"><span class="caption-text">ОБЩЕЕ</span></p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="toctree-l1"><a class="reference external" href="https://pyopenrpa.ru/wiki/guide/index">Выбрать версию</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../01_HowToInstall.html">1. Первый запуск</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../03_Copyrights_Contacts.html">2. Права & Контакты</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="caption"><span class="caption-text">МОДУЛЬ РОБОТ</span></p>
|
|
|
|
|
<ul class="current">
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="01_Robot.html">1. Описание</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="02_Defs.html">2. Функции</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="02_uidesktop.html">2. UIDesktop</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="03_uiweb.html">3. UIWeb</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="04_keyboard.html">4. Keyboard</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="05_clipboard.html">5. Clipboard</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="06_mouse.html">6. Mouse</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="07_image.html">7. Image</a></li>
|
|
|
|
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">8. Как использовать?</a><ul>
|
|
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#how-to-execute-rpa-script">How to execute RPA script</a><ul>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#create-python-script">Create python script</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#execute-python-script">Execute python script</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#execute-in-the-python-x32">Execute in the Python x32</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#execute-in-the-python-x64">Execute in the Python x64</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#execute-from-cmd-file">Execute from .cmd file</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#use-in-studio-script-n-a">Use in studio script (n/a)</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#desktop-app-ui-access-win32-and-ui-automation-dlls">Desktop app UI access (win32 and UI automation dlls)</a><ul>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#definitions">Definitions</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#what-is-uio">What is UIO?</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#uioselector-structure-example">UIOSelector structure & example</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#the-uidesktop-module-openrpa-robot-uidesktop-py">The UIDesktop module (OpenRPA/Robot/UIDesktop.py)</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#id2">The UIDesktop module (OpenRPA/Robot/UIDesktop.py)</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#theory-practice-web-app-ui-access-selenium">Theory & practice. WEB app UI access (selenium)</a><ul>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#about">About</a></li>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-use">How to use</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#theory-practice-keyboard-mouse-manipulation">Theory & practice. Keyboard & mouse manipulation</a></li>
|
|
|
|
|
<li class="toctree-l2"><a class="reference internal" href="#theory-practice-screen-capture-image-recognition">Theory & practice. Screen capture & image recognition</a><ul>
|
|
|
|
|
<li class="toctree-l3"><a class="reference internal" href="#how-to-automate-image-recognition-on-pc">How to automate image recognition on PC</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="09_Dependencies.html">9. Зависимости</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="caption"><span class="caption-text">МОДУЛЬ СТУДИЯ</span></p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Studio/01_Studio.html">1. Описание</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Studio/02_HowToUse.html">2. Как использовать?</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="caption"><span class="caption-text">МОДУЛЬ ОРКЕСТРАТОР</span></p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/01_Orchestrator.html">1. Description</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/02_Defs.html">2. Defs</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/03_gSettingsTemplate.html">3. gSettings Template</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/04_HowToUse.html">4. How to use</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/05_UAC.html">5. UAC - User Access Control</a></li>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Orchestrator/06_Defs%20Managers.html">6. Defs Managers</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="caption"><span class="caption-text">МОДУЛЬ АГЕНТ</span></p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Agent/02_Defs.html">2. Defs</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p class="caption"><span class="caption-text">ИНСТРУМЕНТЫ</span></p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="toctree-l1"><a class="reference internal" href="../Tools/02_Defs.html">2. Defs StopSafe</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<nav class="wy-nav-top" aria-label="top navigation">
|
|
|
|
|
|
|
|
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
|
|
|
<a href="../index.html">pyOpenRPA v1.2.12</a>
|
|
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="wy-nav-content">
|
|
|
|
|
|
|
|
|
|
<div class="rst-content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
|
|
|
|
|
|
|
|
|
<ul class="wy-breadcrumbs">
|
|
|
|
|
|
|
|
|
|
<li><a href="../index.html" class="icon icon-home"></a> »</li>
|
|
|
|
|
|
|
|
|
|
<li>8. Как использовать?</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li class="wy-breadcrumbs-aside">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="../_sources/Robot/08_HowToUse.rst.txt" rel="nofollow"> Просмотреть исходный код страницы</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
</div>
|
|
|
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
|
|
|
<div itemprop="articleBody">
|
|
|
|
|
|
|
|
|
|
<div class="section" id="id1">
|
|
|
|
|
<h1>8. Как использовать?<a class="headerlink" href="#id1" title="Ссылка на этот заголовок">¶</a></h1>
|
|
|
|
|
<p>The Robot tool is the main module for production process automation. It has no graphic/console interface. All low-level actions to OS are perfoming by the Robot tool in pyOpenRPA.</p>
|
|
|
|
|
<div class="section" id="how-to-execute-rpa-script">
|
|
|
|
|
<h2>How to execute RPA script<a class="headerlink" href="#how-to-execute-rpa-script" title="Ссылка на этот заголовок">¶</a></h2>
|
|
|
|
|
<p>You can use the robot by the several ways:</p>
|
|
|
|
|
<ul class="simple">
|
|
|
|
|
<li><p>In Python script</p></li>
|
|
|
|
|
<li><p>In Studio script (n/a)</p></li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="section" id="create-python-script">
|
|
|
|
|
<h3>Create python script<a class="headerlink" href="#create-python-script" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>In order to use robot just add Robot tool folder in work directory and add line «import GUI» in your script.</p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
|
|
|
|
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../../'</span><span class="p">)</span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">selenium</span> <span class="c1"># [Web app access](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.1.-Theory-&-practice:-Web-app-access-(Chrome,-Firefox,-Opera))<br></span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">GUI</span> <span class="c1"># [Win32 & UI Automation access](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.2.-Theory-&-practice:-Desktop-app-UI-access-(win32-and-UI-automation-dlls)) <br></span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">pyautogui</span> <span class="c1">#[Screen capture/recognition](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.4.-Theory-&-practice:-Screen-capture-&-image-recognition) [#Mouse manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.3.-Theory-&-practice:-Keyboard-&-mouse-manipulation)<br></span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">cv2</span> <span class="c1"># [Computer vision](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.4.-Theory-&-practice:-Screen-capture-&-image-recognition)<br></span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">keyboard</span> <span class="c1">#[Keyboard manipulation](https://gitlab.com/UnicodeLabs/OpenRPA/wikis/05.3.-Theory-&-practice:-Keyboard-&-mouse-manipulation)<br></span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="execute-python-script">
|
|
|
|
|
<h3>Execute python script<a class="headerlink" href="#execute-python-script" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>The pyOpenRPA is fully portable solution. It contains own python enviroment both 32 and 64 bit versions. So, you can execute your python script in several ways:
|
|
|
|
|
- Execute in python x32 (OpenRPAResourcesWPy32-3720python-3.7.2)
|
|
|
|
|
- Execute in python x64 (OpenRPAResourcesWPy64-3720python-3.7.2.amd64)
|
|
|
|
|
- Execute from .cmd file</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="execute-in-the-python-x32">
|
|
|
|
|
<h3>Execute in the Python x32<a class="headerlink" href="#execute-in-the-python-x32" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>To execute your python script in x32 bit version just write in command line from x32 python directory:</p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="s2">"\OpenRPA\Resources\WPy32-3720\python-3.7.2"</span>
|
|
|
|
|
<span class="n">python</span><span class="o">.</span><span class="n">exe</span> <span class="s2">"path to your python script.py"</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="execute-in-the-python-x64">
|
|
|
|
|
<h3>Execute in the Python x64<a class="headerlink" href="#execute-in-the-python-x64" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>To execute your python script in x32 bit version just write in command line from x32 python directory:</p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="s2">"\OpenRPA\Resources\WPy64-3720\python-3.7.2.amd64"</span>
|
|
|
|
|
<span class="n">python</span><span class="o">.</span><span class="n">exe</span> <span class="s2">"path to your python script.py"</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="execute-from-cmd-file">
|
|
|
|
|
<h3>Execute from .cmd file<a class="headerlink" href="#execute-from-cmd-file" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>In order to simplify the execution process you can write several code lines in file with the .cmd extension:</p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="o">%~</span><span class="n">dp0</span>
|
|
|
|
|
<span class="n">copy</span> <span class="o">/</span><span class="n">Y</span> <span class="o">..</span>\<span class="n">Resources</span>\<span class="n">WPy32</span><span class="o">-</span><span class="mi">3720</span>\<span class="n">python</span><span class="o">-</span><span class="mf">3.7</span><span class="o">.</span><span class="mi">2</span>\<span class="n">python</span><span class="o">.</span><span class="n">exe</span> <span class="o">..</span>\<span class="n">Resources</span>\<span class="n">WPy32</span><span class="o">-</span><span class="mi">3720</span>\<span class="n">python</span><span class="o">-</span><span class="mf">3.7</span><span class="o">.</span><span class="mi">2</span>\<span class="n">OpenRPAOrchestrator</span><span class="o">.</span><span class="n">exe</span>
|
|
|
|
|
<span class="o">.</span>\<span class="o">..</span>\<span class="n">Resources</span>\<span class="n">WPy32</span><span class="o">-</span><span class="mi">3720</span>\<span class="n">python</span><span class="o">-</span><span class="mf">3.7</span><span class="o">.</span><span class="mi">2</span>\<span class="n">OpenRPAOrchestrator</span><span class="o">.</span><span class="n">exe</span> <span class="n">orchestratorMain</span><span class="o">.</span><span class="n">py</span>
|
|
|
|
|
<span class="n">pause</span> <span class="o">></span><span class="n">nul</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="use-in-studio-script-n-a">
|
|
|
|
|
<h3>Use in studio script (n/a)<a class="headerlink" href="#use-in-studio-script-n-a" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">sys</span>
|
|
|
|
|
<span class="n">sys</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s1">'../../'</span><span class="p">)</span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">GUI</span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">keyboard</span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">subprocess</span>
|
|
|
|
|
<span class="kn">import</span> <span class="nn">time</span>
|
|
|
|
|
|
|
|
|
|
<span class="c1">#Highlight the UI Object in Folder explorer</span>
|
|
|
|
|
<span class="n">GUI</span><span class="o">.</span><span class="n">UIOSelector_FocusHighlight</span><span class="p">([{</span><span class="s2">"class_name"</span><span class="p">:</span><span class="s2">"CabinetWClass"</span><span class="p">,</span><span class="s2">"backend"</span><span class="p">:</span><span class="s2">"uia"</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">}])</span>
|
|
|
|
|
|
|
|
|
|
<span class="c1">#Wait 2 seconds</span>
|
|
|
|
|
<span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span>
|
|
|
|
|
|
|
|
|
|
<span class="c1">#Loop: get child element of UI List</span>
|
|
|
|
|
<span class="k">for</span> <span class="n">lItem</span> <span class="ow">in</span> <span class="n">GUI</span><span class="o">.</span><span class="n">UIOSelector_Get_UIO</span><span class="p">([{</span><span class="s2">"class_name"</span><span class="p">:</span><span class="s2">"CabinetWClass"</span><span class="p">,</span><span class="s2">"backend"</span><span class="p">:</span><span class="s2">"uia"</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">2</span><span class="p">},{</span><span class="s2">"ctrl_index"</span><span class="p">:</span><span class="mi">0</span><span class="p">}])</span><span class="o">.</span><span class="n">children</span><span class="p">():</span>
|
|
|
|
|
<span class="nb">print</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">lItem</span><span class="p">))</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>Here you can find the docs and examples of the OpenRPA desktop (GUI) app access.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="desktop-app-ui-access-win32-and-ui-automation-dlls">
|
|
|
|
|
<h2>Desktop app UI access (win32 and UI automation dlls)<a class="headerlink" href="#desktop-app-ui-access-win32-and-ui-automation-dlls" title="Ссылка на этот заголовок">¶</a></h2>
|
|
|
|
|
<div class="section" id="definitions">
|
|
|
|
|
<h3>Definitions<a class="headerlink" href="#definitions" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<ul class="simple">
|
|
|
|
|
<li><p><strong>UIO</strong> - UI Object (class of pywinauto UI object) [pywinauto.base_wrapper]</p></li>
|
|
|
|
|
<li><p><strong>UIOSelector</strong> - List of dict (key attributes)</p></li>
|
|
|
|
|
<li><p><strong>PWA</strong> - PyWinAuto</p></li>
|
|
|
|
|
<li><p><strong>PWASpecification</strong> - List of dict (key attributes in pywinauto.find_window notation)</p></li>
|
|
|
|
|
<li><p><strong>UIOTree</strong> - Recursive Dict of Dict … (UI Parent -> Child hierarchy)</p></li>
|
|
|
|
|
<li><p><strong>UIOInfo</strong> - Dict of UIO attributes</p></li>
|
|
|
|
|
<li><p><strong>UIOActivity</strong> - Activity of the UIO (UI object) from the Pywinauto module</p></li>
|
|
|
|
|
<li><p><strong>UIOEI</strong> - UI Object info object</p></li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="what-is-uio">
|
|
|
|
|
<h3>What is UIO?<a class="headerlink" href="#what-is-uio" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>UIO is a User Interface Object (pyOpenRPA terminology). For maximum compatibility, this instance is inherited from the object model developed in the [pywinauto library (click to get a list of available class functions)](<a class="reference external" href="https://pywinauto.readthedocs.io/en/latest/code/pywinauto.base_wrapper.html">https://pywinauto.readthedocs.io/en/latest/code/pywinauto.base_wrapper.html</a>).</p>
|
|
|
|
|
<p>This approach allows us to implement useful functionality that has already been successfully developed in other libraries, and Supplement it with the missing functionality. In our case, the missing functionality is the ability to dynamically access UIO objects using UIO selectors.</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="uioselector-structure-example">
|
|
|
|
|
<h3>UIOSelector structure & example<a class="headerlink" href="#uioselector-structure-example" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>UIOSelector is the list of condition items for the UIO in GUI. Each item has condition attributes for detect applicable UIO. Here is the description of the available condition attributes in item.</p>
|
|
|
|
|
<p><strong>Desciption</strong></p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span>[
|
|
|
|
|
{
|
|
|
|
|
"depth_start" :: [int, start from 1] :: the depth index, where to start check the condition list (default 1),
|
|
|
|
|
"depth_end" :: [int, start from 1] :: the depth index, where to stop check the condition list (default 1),
|
|
|
|
|
"ctrl_index" || "index" :: [int, starts from 0] :: the index of the UIO in parent UIO child list,
|
|
|
|
|
"title" :: [str] :: the condition for the UIO attribute *title*,
|
|
|
|
|
"title_re" :: [str] :: regular expression (python ver) for the condition for the UIO attribute *title*,
|
|
|
|
|
"rich_text" :: [str] :: the condition for the UIO attribute *rich_text*,
|
|
|
|
|
"rich_text_re" :: [str] :: regular expression (python ver) for the condition for the UIO attribute *rich_text*,
|
|
|
|
|
"class_name" :: [str] :: the condition for the UIO attribute *class_name*,
|
|
|
|
|
"class_name_re" :: [str] :: regular expression (python ver) for the condition for the UIO attribute *class_name*,
|
|
|
|
|
"friendly_class_name" :: [str] :: the condition for the UIO attribute *friendly_class_name*,
|
|
|
|
|
"friendly_class_name_re" :: [str] :: regular expression (python ver) for the condition for the UIO attribute *friendly_class_name*,
|
|
|
|
|
"control_type" :: [str] :: the condition for the UIO attribute *control_type*,
|
|
|
|
|
"control_type_re" :: [str] :: regular expression (python ver) for the condition for the UIO attribute *control_type*,
|
|
|
|
|
"is_enabled" :: [bool] :: the condition for the UIO attribute *is_enabled*. If UI object is enabled on GUI,
|
|
|
|
|
"is_visible" :: [bool] :: the condition for the UIO attribute *is_visible*. If UI object is visible on GUI,
|
|
|
|
|
"backend" :: [str, "win32" || "uia"] :: the method of UIO extraction (default "win32"). ATTENTION! Current option can be only for the first item of the UIO selector. For the next items this option will be implemented from the first item.
|
|
|
|
|
},
|
|
|
|
|
{ ... specification next level UIO }
|
|
|
|
|
]
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
<p><strong>The UIO selector example</strong></p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">[</span>
|
|
|
|
|
<span class="p">{</span><span class="s2">"class_name"</span><span class="p">:</span><span class="s2">"CalcFrame"</span><span class="p">,</span> <span class="s2">"backend"</span><span class="p">:</span><span class="s2">"win32"</span><span class="p">},</span> <span class="c1"># 1-st level UIO specification</span>
|
|
|
|
|
<span class="p">{</span><span class="s2">"title"</span><span class="p">:</span><span class="s2">"Hex"</span><span class="p">,</span> <span class="s2">"depth_start"</span><span class="p">:</span><span class="mi">3</span><span class="p">,</span> <span class="s2">"depth_end"</span><span class="p">:</span> <span class="mi">3</span><span class="p">}</span> <span class="c1"># 3-rd level specification (because of attribute depth_start|depth_stop)</span>
|
|
|
|
|
<span class="p">]</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="the-uidesktop-module-openrpa-robot-uidesktop-py">
|
|
|
|
|
<h3>The UIDesktop module (OpenRPA/Robot/UIDesktop.py)<a class="headerlink" href="#the-uidesktop-module-openrpa-robot-uidesktop-py" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>The UIDesktop is extension of the pywinauto module which provide access to the desktop apps by the <strong>win32</strong> and <strong>ui automation</strong> dll frameworks (big thx to the Microsoft :) ).</p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># EXAMPLE 1</span>
|
|
|
|
|
<span class="kn">from</span> <span class="nn">pyOpenRPA.Robot</span> <span class="kn">import</span> <span class="n">UIDesktop</span>
|
|
|
|
|
|
|
|
|
|
<span class="n">UIDesktop</span><span class="o">.</span><span class="n">UIOSelector_Get_UIO</span><span class="p">(</span>
|
|
|
|
|
<span class="n">inSpecificationList</span><span class="o">=</span><span class="p">[</span>
|
|
|
|
|
<span class="p">{</span><span class="s2">"title"</span><span class="p">:</span><span class="s2">"notepad.exe"</span><span class="p">},{</span><span class="s2">"title"</span><span class="p">:</span><span class="s2">"OK"</span><span class="p">}],</span>
|
|
|
|
|
<span class="n">inElement</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
|
|
|
|
<span class="n">inFlagRaiseException</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="id2">
|
|
|
|
|
<h3>The UIDesktop module (OpenRPA/Robot/UIDesktop.py)<a class="headerlink" href="#id2" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>The UIDesktop is extension of the pywinauto module which provide access to the desktop apps by the <strong>win32</strong> and <strong>ui automation</strong> dll frameworks (big thx to the Microsoft :) ).</p>
|
|
|
|
|
<p><a href="#id3"><span class="problematic" id="id4">*</span></a>Naming convention: <InArgument>_<ActivityName>_<OutArgument - if exist>*<br></p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="theory-practice-web-app-ui-access-selenium">
|
|
|
|
|
<h2>Theory & practice. WEB app UI access (selenium)<a class="headerlink" href="#theory-practice-web-app-ui-access-selenium" title="Ссылка на этот заголовок">¶</a></h2>
|
|
|
|
|
<div class="section" id="about">
|
|
|
|
|
<h3>About<a class="headerlink" href="#about" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>The pyOpenRPA support web app manipulation (by the Selenium lib).
|
|
|
|
|
More docs about selenium you can find here (<a class="reference external" href="https://selenium-python.readthedocs.io/">https://selenium-python.readthedocs.io/</a>)</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="how-to-use">
|
|
|
|
|
<h3>How to use<a class="headerlink" href="#how-to-use" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>To start use selenium just import selenium modules in the robot tool. Here is the example of the usage.</p>
|
|
|
|
|
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">selenium</span> <span class="kn">import</span> <span class="n">webdriver</span>
|
|
|
|
|
<span class="kn">from</span> <span class="nn">selenium.webdriver.common.keys</span> <span class="kn">import</span> <span class="n">Keys</span>
|
|
|
|
|
|
|
|
|
|
<span class="n">driver</span> <span class="o">=</span> <span class="n">webdriver</span><span class="o">.</span><span class="n">Chrome</span><span class="p">()</span>
|
|
|
|
|
<span class="n">driver</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"http://www.python.org"</span><span class="p">)</span>
|
|
|
|
|
<span class="k">assert</span> <span class="s2">"Python"</span> <span class="ow">in</span> <span class="n">driver</span><span class="o">.</span><span class="n">title</span>
|
|
|
|
|
<span class="n">elem</span> <span class="o">=</span> <span class="n">driver</span><span class="o">.</span><span class="n">find_element_by_name</span><span class="p">(</span><span class="s2">"q"</span><span class="p">)</span>
|
|
|
|
|
<span class="n">elem</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
|
|
|
|
|
<span class="n">elem</span><span class="o">.</span><span class="n">send_keys</span><span class="p">(</span><span class="s2">"pycon"</span><span class="p">)</span>
|
|
|
|
|
<span class="n">elem</span><span class="o">.</span><span class="n">send_keys</span><span class="p">(</span><span class="n">Keys</span><span class="o">.</span><span class="n">RETURN</span><span class="p">)</span>
|
|
|
|
|
<span class="k">assert</span> <span class="s2">"No results found."</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">driver</span><span class="o">.</span><span class="n">page_source</span>
|
|
|
|
|
<span class="n">driver</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
|
|
|
|
</pre></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="theory-practice-keyboard-mouse-manipulation">
|
|
|
|
|
<h2>Theory & practice. Keyboard & mouse manipulation<a class="headerlink" href="#theory-practice-keyboard-mouse-manipulation" title="Ссылка на этот заголовок">¶</a></h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="section" id="theory-practice-screen-capture-image-recognition">
|
|
|
|
|
<h2>Theory & practice. Screen capture & image recognition<a class="headerlink" href="#theory-practice-screen-capture-image-recognition" title="Ссылка на этот заголовок">¶</a></h2>
|
|
|
|
|
<div class="section" id="how-to-automate-image-recognition-on-pc">
|
|
|
|
|
<h3>How to automate image recognition on PC<a class="headerlink" href="#how-to-automate-image-recognition-on-pc" title="Ссылка на этот заголовок">¶</a></h3>
|
|
|
|
|
<p>Here you can find any ways you need to use in your business case:
|
|
|
|
|
- Find the exact match on the screen with the other image
|
|
|
|
|
- Use text recognition module (OCR)
|
|
|
|
|
- Use computer vision (CV) to identify the objects on screen/image/video
|
|
|
|
|
- Use artificial intelligence (AI) to make custom identification/classification/text recognition</p>
|
|
|
|
|
<p> .. v1.2.12 replace:: v1.2.12
|
|
|
|
|
.. <a href="#id5"><span class="problematic" id="id6">|author|</span></a> replace:: Ivan Maslov <<a class="reference external" href="mailto:ivan.maslov%40unicodelabs.ru">ivan<span>.</span>maslov<span>@</span>unicodelabs<span>.</span>ru</a>></p>
|
|
|
|
|
<p></p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<footer>
|
|
|
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
|
|
|
|
<a href="09_Dependencies.html" class="btn btn-neutral float-right" title="9. Зависимости" accesskey="n" rel="next">Следующая <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
|
|
|
|
<a href="07_image.html" class="btn btn-neutral float-left" title="7. Image" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Предыдущая</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
|
|
|
|
<div role="contentinfo">
|
|
|
|
|
<p>
|
|
|
|
|
© Copyright 2022, ООО "ОПЕН РПА".
|
|
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Собрано при помощи <a href="https://www.sphinx-doc.org/">Sphinx</a> с использованием
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/readthedocs/sphinx_rtd_theme">темы,</a>
|
|
|
|
|
|
|
|
|
|
предоставленной <a href="https://readthedocs.org">Read the Docs</a>.
|
|
|
|
|
|
|
|
|
|
</footer>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
jQuery(function () {
|
|
|
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|