Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
【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