Using Selenium 3.0.2 with python 3.5.1 and firefox 52, the following selenium code throws the error:
AttributeError: 'WebDriver' object has no attribute 'getCurrentUrl'
Any thoughts on why this is happening or what to use instead of getCurrentUrl?
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import unittest, time, re
class TestURL(unittest.TestCase):
def setUp(self):
capabilities = DesiredCapabilities.FIREFOX.copy()
capabilities.update({'acceptInsecureCerts': True})
binary = FirefoxBinary('/var/lib/firefox/firefox')
profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True
self.driver = webdriver.Firefox(firefox_binary=binary,firefox_profile=profile, capabilities=capabilities)
self.driver.implicitly_wait(30)
self.base_url = "http://www.python.org"
self.verificationErrors = []
def test_load(self):
driver = self.driver
driver.get(self.base_url)
url = driver.getCurrentUrl()
try: self.assertEqual("http://www.python.org", url)
except AssertionError as e: self.verificationErrors.append(str(e))
def tearDown(self):
self.driver.quit()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
Error:
E
======================================================================
ERROR: test_load (__main__.TestURL)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test.py", line 26, in test_load
url = driver.getCurrentUrl()
AttributeError: 'WebDriver' object has no attribute 'getCurrentUrl'
----------------------------------------------------------------------
Ran 1 test in 10.202s
FAILED (errors=1)