【发布时间】:2017-11-21 06:30:16
【问题描述】:
在 Selenium Webdriver 中,我正在使用 Pycharm 中的 Python 开发,其中我使用简单的类,其中调用了两种方法分别在 Chrome 和 Safari 中打开 URL。
from selenium import webdriver
class Automation():
def Safari(self):
driver = webdriver.Safari()
driver.get('https://bizplace.theentertainerme.com')
def Chrome(self):
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
driver.get('https://bizplace.theentertainerme.com')
auto = Automation
auto.Safari(self)
现在执行后,我收到如下错误:
auto.Safari(self)
NameError: name 'self' is not defined
我正在尝试通过命令行安装 self 包,它给我一个这样的错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/hh/bwg2n8w54cd7852cx91v21qm0000gp/T/pip-build-XVmlLB/public/setup.py", line 28, in <module>
setup_cfg_data = read_configuration(path)
File "/private/var/folders/hh/bwg2n8w54cd7852cx91v21qm0000gp/T/pip-build-XVmlLB/public/setup.py", line 23, in read_configuration
val = open(val).read()
IOError: [Errno 2] No such file or directory: './README.rst'
谁能帮帮我。
【问题讨论】:
标签: python python-3.x selenium-webdriver pycharm