Can I read the browser url using selenium webdriver?


I am using python2.7 with beautiful Soup4 and Selenium webdriver. Now in my webautomation script i will open the link or URL and get into the home page. Now I need to click onto some anchor Labels to navigate through other pages.I did till now. now when i will be going to a new page, I need to get the new URL from the browser as I need to pass it Beautiful Soup4 for webpage scraping. So now my concern is how to get such URLs dynamic way?

Please advice if any!

1/4/2013 11:13:30 PM

Accepted Answer

You get current_url attribute on the driver:

from selenium import webdriver
browser = webdriver.Firefox()
print browser.current_url
1/4/2013 11:29:02 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow