Selenium Webdriver with Python - driver.title parameter

36,930

I'm not sure what you are asking here.

Other driver.x parameters can be found in documentation or source code.

# Generally I found the following might be useful for verifying the page:
driver.current_url
driver.title

# The following might be useful for verifying the driver instance:
driver.name
driver.orientation
driver.page_source
driver.window_handles
driver.current_window_handle
driver.desired_capabilities
Share:
36,930
StacyM
Author by

StacyM

I just started learning HTML, CSS, Javascript and JQuery. Please be nice to me!

Updated on July 09, 2022

Comments

  • StacyM
    StacyM almost 2 years

    I'm new to Python and Selenium. How is the driver.title parameter is derived? Below is a simple webdriver script. How do you find what other driver.x parameters there are to use with the various asserts in the unittest module?

    import unittest
    from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    
    class PythonOrgSearch(unittest.TestCase):
    
        def setUp(self):
            self.driver = webdriver.Firefox()
    
        def test_search_in_python_org(self):
            driver = self.driver
            driver.get("http://www.python.org")
            self.assertIn("Python", driver.title)
            elem = driver.find_element_by_name("q")
            elem.send_keys("selenium")
            elem.send_keys(Keys.RETURN)
            self.assertIn("Google", driver.title)
    
        def tearDown(self):
            self.driver.close()
    
    if __name__ == "__main__":
        unittest.main()