How does Selenium Webdriver Open URL in Firefox?

How does Selenium Webdriver Open URL in Firefox?

To open URL in Selenium WebDriver Firefox, every user should know how to import the module in Python and get access to imported functions of the module.

Step 1:

Import the needed modules. For facilitating WebDriver implementations, you can use selenium.webdriver module such as Google Chrome, Firefox, Remote WebDriver and Internet Explorer.

Python 1 from selenium import webdriver

Step 2:

Build an instance for Firefox driver

Python 1 driver = webdriver.Firefox() Step 3:

Load your choice of the URL. WebDriver would be waiting patiently until loading page is completed (the “onload” event has fired) before you return control to next script line. During an AJAX calls on load, it might not be upto the knowledge of WebDriver to know if the page loading has taken place completely.

Python 1 driver.get(“http://www.google.com”) Final block of code:

Python 1 from selenium import webdriver 2 ​ 3 driver = webdriver.Firefox() driver.get(“http://www.google.com”) Save this in a python file ‘OpenUrlInFirefoxBrowser.py’ and execute.

We could see Firefox browser opens and URL given is loaded.