se_option.py 570 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. """
  4. @Contact : liuyuqi.gov@msn.cn
  5. @Time : 2024/07/05
  6. @License : Copyright © 2017-2022 liuyuqi. All Rights Reserved.
  7. @Desc :
  8. """
  9. from selenium import webdriver
  10. from selenium.webdriver.common.by import By
  11. import time
  12. from selenium.webdriver.edge.service import Service
  13. service = Service(verbose = True)
  14. driver = webdriver.Edge(service=service)
  15. driver.get('https://bing.com')
  16. element = driver.find_element(By.ID, 'sb_form_q')
  17. element.send_keys('WebDriver')
  18. element.submit()
  19. time.sleep(5)
  20. driver.quit()