Selenium Python - Getting the current URL of web browser? <p>I have this so far:</p> <pre><code>from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome('C:\Users\Fan\Desktop\chromedriver.exe') url = driver.current_url print url </code></pre> <p>It keeps saying that line 4 "driver" is an invalid syntax. How would I fix this?</p> <p>Also is there a way I can get all the current tabs open, and not just a single one?</p> <p>EDIT: the above code works now; But I have another problem! </p> <p>The code now opens a new tab, and for some reason the URL bar has "data;" in it, and it outputs data; as the print.</p> <p>But I want it to take the existing URL from existing web browser already opened, how do I solve this?</p>