I researched this as much as I could on my own but came to no clear conclusion to my question. I've been teaching myself automation testing via Python + Selenium, I'm as new or n00b as it gets so bare with me. I've come across this line in some of my tutorials:

self.assertIn but more like this, self.assertIn("Python", driver.title) and I've also seen it like this (simple use, not in unittest) assert "Python" in driver.title

... so far I've been able to grasp the tutorials, at least where my progress has taken me but I do not understand the function of this driver.title. Any help would be much appreciated.

Thanks in advance for your time.


It is getting the title of the web page and seeing if it has Python in it.

How much HTML do you know?

  • Thank you for your comment, Phil. I know a bit of HTML, actually although python and selenium are very new to me. Does the title in the test have to match word-for-word the title in the browser? Thank you for your input. Feb 28 '14 at 18:52
  • Also, what is the best place to find a complete or extensive guide to syntax. I've read through these links link and link but they just don't seem to have a complete library to read through, or maybe it's just my initial ignorance into this venture. Feb 28 '14 at 18:58
  • See this thread for different ways of using the title - contains or exact - sqa.stackexchange.com/questions/7887/… Feb 28 '14 at 20:03
  • Did you look here - and links from here - for basic webdriver info? docs.seleniumhq.org/docs/03_webdriver.jsp Feb 28 '14 at 20:04
  • Thank you again, Phil. I guess it's just eagerness on my part. Wanting to take it all in. I forgot that the journey is just as important as the end. Feb 28 '14 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.