Selenium is a powerful tool to programmatically manipulate an internet browser. It supports all major browsers, runs on all major operating systems, and has scripts written in many different languages, including Python, Java, C#, and others.
An interface called Selenium WebDriver enables us to run tests on browsers. It enables us to write test scripts in the programming language of our choice.
Note: Before installing the selenium web bindings, run the following command to ensure that Python has been installed.
python --version
To install the selenium web bindings using pip
, run the following command:
pip install selenium
refresh()
methodThe refresh()
method is used to refresh the currrent page in selenium.
driver.refresh()
Let’s look at the code below:
from selenium import webdriverdriver = webdriver.Firefox(executable_path="path to the driver")driver.get("https://educative.io/")driver.refresh()driver.close()
webdriver
from the selenium
module.Firefox()
method. The path to the driver is specified. The driver can be downloaded from here.https://educative.io
web pagerefresh()
method.close()
method.