coding:utf-8
from selenium import webdriver
def open_beowser(name,url):
if name == 'Chrome':
driver = webdriver.Chrome()
if name == 'fox':
driver = webdriver.Firefox()
if name == 'IE':
driver = webdriver.IE()
driver.get(url)
driver.maximize_window()
return driver
class TestKeys():
def init(self,name,url):
self.driver = open_beowser(name,url)
另一个文件调用的时候说driver在没有赋值前引用了,求大神帮忙看下
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
你输入的name 是什么, 这三个 的webdriver 都有嘛? 看看错误截图
你可以看看我博客,首先你要安装驱动,配置环境变量,配置好了在调用https://www.cnblogs.com/pythonywy/p/11234164.html,先安装环境再编辑代码
大小写没有区分