In the code below I am trying to print the tab title and it open the tab but after that python giving me a TypeError and the program crashes.
from selenium import webdriver
path = "C:\Program Files\chromedriver.exe"
driver = webdriver.Chrome(path)
driver.get() # in the parentheses is a link like https://link.com/
print(driver.title())
driver.quit()
What is the problem? and how can I fix it?
title is an attritibute, but not a method. It returns the title of the current page.
Usage:
title = driver.title
You need to remove the parenthesis. So effectively, the line of code will be:
print(driver.title)