循环driver.get URL(webdriver python)

时间:2016-10-14 19:39:31

标签: python selenium selenium-webdriver webdriver

如何在Python Selenium WebDriver中无限循环URL?我试过time.sleep driver.refresh(),但效率不高。

    from selenium import webdriver
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.common.exceptions import TimeoutException
    import os
    import time

    chromedriver = "chromedriver.exe"

    driver = webdriver.Chrome()
    driver.get("http://www.example.com/load")

1 个答案:

答案 0 :(得分:1)

from selenium import webdriver


driver = webdriver.Chrome()
driver.maximize_window()
print "To quit the program, please kill the program or close browser"
while True:
    driver.get("http://www.bbc.com/")

这将有助于解决您的问题