ai客服
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.1 KiB

1 month ago
  1. import sys
  2. def replace_locators():
  3. with open('/Users/getmind/ds/kf/erp_automation.py', 'r') as f:
  4. content = f.read()
  5. # The string that might appear
  6. old_locators = [
  7. "\"input#confirm_confirm, span#confirmBtn, .layui-layer-btn0, a:text-is('确定'), button:text-is('确定')\"",
  8. "\"input#confirm_confirm, span#confirmBtn, span.btn_1:has-text('确认'), span:text-is('确认'), .layui-layer-btn0, a:text-is('确定'), button:text-is('确定')\"",
  9. "'input#confirm_confirm, span#confirmBtn, .layui-layer-btn0, a:text-is(\\'确定\\'), button:text-is(\\'确定\\')'",
  10. ]
  11. new_locator = "\"input#confirm_confirm, span#confirmBtn, span.btn_1:has-text('确认'), span:text-is('确认'), .layui-layer-btn0, a:text-is('确定'), button:text-is('确定'), a:text-is(''), button:text-is(''), span:text-is(''), div:text-is('')\""
  12. for old_loc in old_locators:
  13. content = content.replace(old_loc, new_locator)
  14. with open('/Users/getmind/ds/kf/erp_automation.py', 'w') as f:
  15. f.write(content)
  16. if __name__ == '__main__':
  17. replace_locators()