How to refresh an already opened web page

前端 未结 6 1590
孤城傲影
孤城傲影 2021-01-01 14:12

I just want to refresh an already opened web page with Selenium.

It always opens a new browser window.

What I\'m doing wrong?

fr         


        
6条回答
  •  孤独总比滥情好
    2021-01-01 14:51

    The problem is you are opening the webdriver and then trying to refresh when you have not specified a URL.

    All you need to do is get your desired URL before refreshing:

    from selenium import webdriver
    import urllib
    import urllib2
    driver = webdriver.Firefox()
    driver.get("Your desired URL goes here...")
    #now you can refresh the page!
    driver.refresh()
    

提交回复
热议问题