Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created February 26, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/65a811db8b05d8c54a98 to your computer and use it in GitHub Desktop.
Save kurozumi/65a811db8b05d8c54a98 to your computer and use it in GitHub Desktop.
【Python】Seleniumを使って標準入力で指定した回数分だけF5キーを押す方法
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
cnt = raw_input()
driver = webdriver.Firefox()
driver.get("http://www.yahoo.co.jp")
for i in range(0, int(cnt)):
driver.find_element_by_tag_name("body").send_keys(Keys.F5)
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment