define_steps.py 446 B

123456789101112131415161718192021222324
  1. import pandas as pd
  2. import json
  3. path_to_excel = '../BaangtDBFill.xlsx'
  4. path_to_json = 'teststeps.json'
  5. xl = pd.ExcelFile(path_to_excel)
  6. df = xl.parse('data')
  7. #print(df)
  8. steps = []
  9. for i in range(len(df)):
  10. step = {
  11. 'name': df['Name'][i],
  12. 'description': df['Description'][i],
  13. 'activity_type': df['ActivityType'][i],
  14. 'locator_type': 'xpath',
  15. }
  16. steps.append(step)
  17. # dump to json
  18. with open(path_to_json, 'w') as f:
  19. json.dump(steps, f)