SHARE
TWEET

selenium-commands-demo

steve-shambles-2109 Feb 17th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. """ Code-snippet-vol_43-snip_215-Selenium special.
  2.    Open page, click link, browser back, browser forward, browser refresh.
  3.  
  4. Requirements:
  5. -------------
  6. pip3 install selenium
  7. geckodriver.exe in python path.
  8. firefox browser
  9.  
  10. By Steve Shambles. Feb 2020
  11. stevepython.wordpress.com
  12. """
  13. from selenium import webdriver
  14. from selenium.webdriver.common.keys import Keys
  15. from time import sleep
  16.  
  17. driver = webdriver.Firefox()
  18. driver.get('https://python-forum.io/')
  19.  
  20. # Click on the "GUI" forum button text.
  21. driver.find_element_by_link_text('GUI').click()
  22. sleep(2)
  23. driver.back()
  24. sleep(2)
  25. driver.forward()
  26. sleep(2)
  27. driver.refresh()
  28. sleep(2)
  29. driver.quit()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top