我正在研究macOS Sierra中的自动化东西(10.12.2).通过使用python的atomac支持,我可以启动Safari浏览器并通过Safari启用设置 - >首选项 - >高级 - >选中"启用开发菜单",然后选择"开发 - >允许远程自动化".看起来这对于自动化角度来说并不是那么一致.我想知道是否有任何shell命令可以实现这一点.
嘿,我在这里看了一下老问题,但它没有回答我的问题
我已经安装了libpng,然后尝试安装autopy并获得complie错误.
我不擅长python但所以我不确定如何修复它们.
Ashley:~ ashleyhughes$ sudo easy_install autopy
Searching for autopy
Reading http://pypi.python.org/simple/autopy/
Reading http://www.autopy.org
Best match: autopy 0.51
Downloading http://pypi.python.org/packages/source/a/autopy/autopy-0.51.tar.gz#md5=b92055aa2a3712a9c3b4c874014b450e
Processing autopy-0.51.tar.gz
Running autopy-0.51/setup.py -q bdist_egg --dist-dir /tmp/easy_install-U9uWoj/autopy-0.51/egg-dist-tmp-hdjtIx
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
clang: warning: argument unused during compilation: '-mno-fused-madd'
src/screengrab.c:48:26: warning: implicit declaration of function
'CGDisplayBitsPerPixel' is invalid in C99
[-Wimplicit-function-declaration]
bitsPerPixel = (uint8_t)CGDisplayBitsPerPixel(displayID);
^ …Run Code Online (Sandbox Code Playgroud) 我正在做的事情:
我正在尝试使用pywinauto在python中创建脚本以在后台自动安装notepad ++(隐藏或最小化),notepad ++只是一个示例,因为我将编辑它以与其他软件一起使用.
问题:
问题是我想在隐藏或最小化安装程序时执行此操作,但如果我移动鼠标,脚本将停止工作.
题:
如何隐藏或最小化notepad ++安装程序,如何执行此脚本并使其正常工作.
到目前为止这是我的代码:
import sys, os, pywinauto
pwa_app = pywinauto.application.Application()
app = pywinauto.Application().Start(r'npp.6.8.3.Installer.exe')
Wizard = app['Installer Language']
Wizard.NextButton.Click()
Wizard = app['Notepad++ v6.8.3 Setup']
Wizard.Wait('visible')
Wizard['Welcome to the Notepad++ v6.8.3 Setup'].Wait('ready')
Wizard.NextButton.Click()
Wizard['License Agreement'].Wait('ready')
Wizard['I &Agree'].Click()
Wizard['Choose Install Location'].Wait('ready')
Wizard.Button2.Click()
Wizard['Choose Components'].Wait('ready')
Wizard.Button2.Click()
Wizard['Create Shortcut on Desktop'].Wait('enabled').CheckByClick()
Wizard.Install.Click()
Wizard['Completing the Notepad++ v6.8.3 Setup'].Wait('ready', timeout=30)
Wizard['CheckBox'].Wait('enabled').Click()
Wizard.Finish.Click()
Wizard.WaitNot('visible')
Run Code Online (Sandbox Code Playgroud) 我正确地在我的raspi上通过pip-3.2安装了pyautogui模块和依赖项,但是当我尝试做的时候
import pyautogui
Run Code Online (Sandbox Code Playgroud)
我收到导入错误:
ImportError: No module named pyautogui
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?命令改变了吗?对不起,我是一个完整的python Noob,非常感谢任何帮助:D
代码是:
import pyautogui
startButton = pyautogui.locateOnScreen('start.png')
print startButton
Run Code Online (Sandbox Code Playgroud)
要么:
import pyautogui
startButton = pyautogui.locateCenterOnScreen('start.png')
print startButton
Run Code Online (Sandbox Code Playgroud)
输出为:
None
Run Code Online (Sandbox Code Playgroud)
注意:根据文档,正确的语法似乎正确。
注意:我也尝试过使用图像完整路径。该图像在屏幕上,并且没有与其他图像重叠。还将安装pil库。其他pyautogui功能有效(包括截图)
请让我知道我错过了什么。或者,建议使用另一个Python库进行图像检测。
我正在使用我的主机,我曾经在那里连接到我想获取一些数据的远程机器。我正在使用 pyautogui 进行按下操作和 typewrite() 来输入一些值。远程服务器已配置,当我连接到远程机器时,我要操作的应用程序将始终打开。
我可以通过 pyautogui 登录。
之后,当我写下面的代码时:
pyautogui.press('esc')
pyautogui.press('f1')
pyautogui.typewrite("T")
Run Code Online (Sandbox Code Playgroud)
它没有在远程服务器上打开的应用程序上键入 T 。请建议我一些python方法,以便我可以克服这个问题。
谢谢 Simun
我pyautogui大约一小时前开始使用.很好,python支持GUI自动化.我有一个问题.我使用两个屏幕,看起来包装器无法将光标移动到我的辅助监视器.例如:
>>> import pyautogui
>>> pyautogui.moveTo(2759,769)
>>> pyautogui.position()
(1919, 769)
Run Code Online (Sandbox Code Playgroud)
如您所见,光标仍在我的第一个屏幕内.
如何强制pyautogui移动到我的第二个屏幕?
谢谢
我正在为我的桌面应用程序使用 Python 编写自动化脚本。我正在将 TAB 键/任意键发送到我的 Windows 窗体。但我无法在 Python 脚本中找到该 Windows 窗体的句柄。
这是示例代码片段:
__author__ = 'juhis'
import SendKeys
import sys
import os
from Tkinter import *
import ctypes
import win32gui
import pywinauto
pwapp = pywinauto.application.Application()
whandle = pywinauto.findwindows.find_windows(title_re='Form1',class_name='WindowsForms10.Window.8.app.0.2bf8098_r13_ad1')[0]
window1 = pwapp.window_(handle=whandle)
window1.SetFocus()
SendKeys.SendKeys("""{PAUSE 2}""")
SendKeys.SendKeys("""{TAB 2}{PAUSE 2}{ENTER}""")
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题。
-谢谢
我似乎在安装autopy.h时遇到了一些麻烦
https://github.com/msanders/autopy/#introduction
Run Code Online (Sandbox Code Playgroud)
我已经通过git尝试了安装:
$ git clone git://github.com/msanders/autopy.git
$ cd autopy
$ python setup.py build
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
>python setup.py build
running build
running build_py
running build_ext
building 'color' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DNDEBUG=1 -DMM_LITTLE_ENDIAN -DUSE_X11 -I/usr/include/python2.6 -c src/autopy-color-module.c -o build/temp.linux-i686-2.6/src/autopy-color-module.o -Wall -Wparentheses -Winline -Wbad-function-cast -Wdisabled-optimization -Wshadow
In file included from src/autopy-color-module.c:1:
src/autopy-color-module.h:5:20: error: Python.h: No such file or directory
In file included from src/autopy-color-module.c:1:
src/autopy-color-module.h:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initcolor’ …Run Code Online (Sandbox Code Playgroud) python ×7
pyautogui ×4
autopy ×2
pywinauto ×2
automation ×1
detection ×1
image ×1
import ×1
install ×1
macos ×1
macos-sierra ×1
module ×1
pyatom ×1
python-2.7 ×1
python-3.x ×1
pywin32 ×1
safari ×1
winforms ×1