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.

27 lines
1.1 KiB

1 month ago
  1. import sys
  2. def revert_inner_text():
  3. with open('/Users/getmind/ds/kf/erp_automation.py', 'r') as f:
  4. content = f.read()
  5. # The block we added
  6. bad_code = """ try:
  7. row_text = row.evaluate("el => el.innerText")
  8. row_html = row.evaluate("el => el.innerHTML")
  9. except:
  10. row_text = ""
  11. row_html = "" """
  12. good_code = """ row_text = row.inner_text(timeout=2000)
  13. try:
  14. row_html = row.inner_html(timeout=2000)
  15. except:
  16. row_html = "" """
  17. content = content.replace(bad_code, good_code)
  18. with open('/Users/getmind/ds/kf/erp_automation.py', 'w') as f:
  19. f.write(content)
  20. if __name__ == '__main__':
  21. revert_inner_text()