- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Find and click element by title Python Selenium.
We can find and click elements by title in Selenium webdriver. An element can be identified with a title attribute with xpath or css selector. With the xpath, the expression should be //tagname[@title='value']. In css, the expression should be tagname[title='value'].
Let us take an html code for an element with a title attribute.
The xpath to identify the element should be //a[@title='Tutorialspoint'] and the css expression should be a[title='Tutorialspoint']. Once the element is identified we can use the click() method for clicking on it.
from selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") # implicit wait for 5 seconds driver.implicitly_wait(5) # maximize with maximize_window() driver.maximize_window() driver.get("https://www.tutorialspoint.com/about/about_careers.htm") # identify element with title attribute and click() l=driver.find_element_by_xpath("//a[@title='Tutorialspoint']") l.click() print("Current page title: " + driver.title) driver.quit()
- Find Element and FindElements by XPath in Selenium
- Selenium Click Link By href Value
- Click a href button with Selenium and Python?
- Find Element and FindElements in Selenium
- How to click button Selenium Python?
- How to perform double click on an element in Selenium with python?
- How to perform right click on an element in Selenium with python?
- Find div element by multiple class names in Selenium?
- How to click on hidden element in Selenium WebDriver?
- Find next sibling element in Selenium, Python?
- Is there a way to find an element by attributes in Python Selenium?
- Difference between find Element and find Elements in Selenium
- How to perform double click on an element in Selenium?
- How to find a radio button element by value using Selenium?