import configparser
from selenium import webdriver
class ReadIni(object):
def __init__(self,file_name=None,node=None):
if file_name == None:
file_name = 'D:\迅雷下载\pytest\selenium_learn\LocalElement.ini'
if node == None:
self.node = 'RegisterElement'
else:
self.node = node
self.cf = self.load_ini(file_name)
#加载文件
def load_ini(self,file_name):
cf = configparser.ConfigParser()
cf.read(file_name)
return cf
#获取value的值,get得到标题[registerelement],key就是左边蓝色字
def get_value(self,key):
data = self.cf.get(self.node,key)
return data
if __name__ == '__main__':
read_init = ReadIni()
print(read_init.get_value('user_name'))
我对着视频写的。这个类里也没有定义过driver,在find_element.py里导入from selenium_learn.util.read_ini import ReadIni 成功了后。怎么调用出driver后面的查找元素方法呢