执行 Macaca 的 demo 时报错
Traceback (most recent call last):
File "test.py", line 3, in <module>
from macaca import WebDriver
File "/Library/Python/2.7/site-packages/macaca/__init__.py", line 25, in <module>
from .webdriver import WebDriver
File "/Library/Python/2.7/site-packages/macaca/webdriver.py", line 697
*, asserter=lambda x: x):
^
SyntaxError: invalid syntax
这个报错看样子是 macaca 的 webdriver.py 的语法不正确导致的。
我的 macaca 安装是正常的。
Node.js checklist:
node env: /usr/local/bin/node
node version: v5.3.0
iOS checklist:
Xcode is installed at: `/Applications/Xcode.app/Contents/Developer`
Xcode Command Line Tools is ready, version: 2343.
ios_webkit_debug_proxy is installed at: /usr/local/bin/ios_webkit_debug_proxy
Android checklist:
JAVA version is `1.7.0_79`
JAVA_HOME is set to `/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home`
ANDROID_HOME is set to `/Users/SvenWeng/Desktop/android-sdk-macosx`
Platforms is set to `/Users/SvenWeng/Desktop/android-sdk-macosx/platforms/android-23`
Android tools is set to `/Users/SvenWeng/Desktop/android-sdk-macosx/tools/android`
Installed driver list:
wd 模块安装正常,我是使用官方的pip install wd
命令来安装的。
但是在下载源码安装的时候也有类似的报错。
running install
running bdist_egg
running egg_info
creating wd.egg-info
writing requirements to wd.egg-info/requires.txt
writing wd.egg-info/PKG-INFO
writing top-level names to wd.egg-info/top_level.txt
writing dependency_links to wd.egg-info/dependency_links.txt
writing manifest file 'wd.egg-info/SOURCES.txt'
reading manifest file 'wd.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'wd.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.11-intel/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/macaca
copying macaca/__init__.py -> build/lib/macaca
copying macaca/asserters.py -> build/lib/macaca
copying macaca/command.py -> build/lib/macaca
copying macaca/keys.py -> build/lib/macaca
copying macaca/locator.py -> build/lib/macaca
copying macaca/remote_invoker.py -> build/lib/macaca
copying macaca/util.py -> build/lib/macaca
copying macaca/webdriver.py -> build/lib/macaca
copying macaca/webdriverexception.py -> build/lib/macaca
copying macaca/webdriverresult.py -> build/lib/macaca
copying macaca/webelement.py -> build/lib/macaca
creating build/bdist.macosx-10.11-intel
creating build/bdist.macosx-10.11-intel/egg
creating build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/__init__.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/asserters.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/command.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/keys.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/locator.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/remote_invoker.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/util.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/webdriver.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/webdriverexception.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/webdriverresult.py -> build/bdist.macosx-10.11-intel/egg/macaca
copying build/lib/macaca/webelement.py -> build/bdist.macosx-10.11-intel/egg/macaca
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/asserters.py to asserters.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/command.py to command.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/keys.py to keys.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/locator.py to locator.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/remote_invoker.py to remote_invoker.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/util.py to util.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/webdriver.py to webdriver.pyc
File "build/bdist.macosx-10.11-intel/egg/macaca/webdriver.py", line 698
*, asserter=lambda x: x):
^
SyntaxError: invalid syntax
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/webdriverexception.py to webdriverexception.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/webdriverresult.py to webdriverresult.pyc
byte-compiling build/bdist.macosx-10.11-intel/egg/macaca/webelement.py to webelement.pyc
File "build/bdist.macosx-10.11-intel/egg/macaca/webelement.py", line 148
*, asserter=lambda x: x):
^
SyntaxError: invalid syntax
creating build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying wd.egg-info/PKG-INFO -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying wd.egg-info/SOURCES.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying wd.egg-info/dependency_links.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying wd.egg-info/requires.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
copying wd.egg-info/top_level.txt -> build/bdist.macosx-10.11-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/wd-0.1.1-py2.7.egg' and adding 'build/bdist.macosx-10.11-intel/egg' to it
removing 'build/bdist.macosx-10.11-intel/egg' (and everything under it)
Processing wd-0.1.1-py2.7.egg
Copying wd-0.1.1-py2.7.egg to /Library/Python/2.7/site-packages
Adding wd 0.1.1 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/wd-0.1.1-py2.7.egg
Processing dependencies for wd==0.1.1
Searching for retrying==1.3.3
Best match: retrying 1.3.3
Adding retrying 1.3.3 to easy-install.pth file
Using /Library/Python/2.7/site-packages
Searching for requests==2.9.1
Best match: requests 2.9.1
Adding requests 2.9.1 to easy-install.pth file
Using /Library/Python/2.7/site-packages
Searching for six==1.10.0
Best match: six 1.10.0
Adding six 1.10.0 to easy-install.pth file
Using /Library/Python/2.7/site-packages
Finished processing dependencies for wd==0.1.1