文件目录:
import os
import sys
# curPath = os.path.abspath(os.path.dirname(__file__))
# rootPath = os.path.split(curPath)[0]
# sys.path.append(rootPath)
import json
jsonDir=os.path.split(os.path.realpath(os.getcwd()))[0]
jsonPath=os.path.join(jsonDir+'\\'+'config','loginelement.json')
with open(jsonPath, 'r')as f:
json_data = dict(json.load(f))
jsonfile=json_data
class Login(object):
# def __init__(self,driver):
# self.driver=driver
# def jsonfile(self):
# with open(jsonPath,'r')as f:
# json_data=dict(json.load(f))
# return json_data
def xpath(self):
return 'xpath_login',jsonfile['xpath_login']
def class_name_phone(self):
return 'elements_class_name_phone',jsonfile['elements_class_name_phone']
def class_name_code(self):
return 'elements_class_name_code',jsonfile['elements_class_name_code']
def class_name_confirm(self):
return 'class_name_confirm',jsonfile['class_name_confirm']
if __name__=='__main__':
# s=Login()
# print(s.xpath()[1])
pass