Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 808
Arup Rakshit Avatar asked Jan 04 '13 23:01

Arup Rakshit


1 Answers

You get current_url attribute on the driver:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.google.com')
print(browser.current_url)
like image 63
Zeugma Avatar answered Oct 18 '22 07:10

Zeugma