Navigation¶
Methods for navigating between web pages.
navigate(url)¶
Navigates to a URL. Waits for the page to load completely.
get_current_url()¶
Returns the current page URL.
back()¶
Goes back to the previous page (like the browser's back button).
driver.navigate("https://site.com/page1")
driver.navigate("https://site.com/page2")
driver.back() # Returns to page1
forward()¶
Goes forward to the next page (like the browser's forward button).
refresh()¶
Reloads the current page.
Complete Example¶
from cdriv import CDriv
with CDriv() as driver:
driver.new_session()
driver.navigate("https://site.com/login")
print(driver.get_current_url())
# Simulate navigation flow
driver.navigate("https://site.com/dashboard")
driver.back() # Back to login
driver.forward() # Forward to dashboard
driver.refresh() # Reload dashboard