Opening a Browser & Navigating to URLs
Launching a Browser Session
The first real action in almost every Selenium script is creating a browser instance. This single line of code launches an actual browser window that Selenium will control for the remainder of the script.
Navigating to a URL
Once the browser is open, Selenium provides simple commands to load a specific web page. This is typically done through a 'get' method that takes the full URL as its argument and waits for the page to begin loading.
- driver.get() - loads a specified URL in the current browser window
- driver.current_url - returns the URL currently loaded in the browser
- driver.title - returns the title of the currently loaded page
Handling Page Load Timing
| Wait Type | Purpose |
|---|---|
| Implicit Wait | Applies a default wait time across all element lookups |
| Explicit Wait | Waits for a specific condition, like an element becoming visible |
| Fluent Wait | Polls repeatedly with custom intervals until a condition is met |
Dealing with Redirects
Some URLs automatically redirect to another page after loading. Selenium handles this transparently in most cases, but it's good practice to verify the final URL matches what you expect before continuing with further actions.
Once you can reliably open browsers and load pages, the next step is learning to manage multiple windows, tabs, and navigation actions during a test.
Ready to master Selenium Training Course?
Join Uncodemy's hands-on training and build real automation skills with expert mentors.
← Back to Course