I just want to refresh an already opened web page with Selenium
.
It always opens a new browser window.
What I'm doing wrong?
from selenium import webdriver
import urllib
import urllib2
driver = webdriver.Firefox()
driver.refresh()
I just want to refresh an already opened web page with Selenium
.
It always opens a new browser window.
What I'm doing wrong?
from selenium import webdriver
import urllib
import urllib2
driver = webdriver.Firefox()
driver.refresh()
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:
I would suggest binding the driver element search to the tag body and use the refresh command of the browser.
In OSX for example
Documentation on keys here: http://selenium-python.readthedocs.org/en/latest/api.html
Update: The following code, very similar to your one, works fine for me.
Are you sure you correctly load the web page with the driver before refreshing it ?
You can try any one of the below methods for the same.
Method 1:
Method 2:
Method3:
Method4: