troubleshooting Question

Python selenium xpath question

Avatar of Hiro 714
Hiro 714 asked on
PythonSelenium
8 Comments2 Solutions4 ViewsLast Modified:
How do I get a whole row data with xpath?
I'm getting only header
Xpath

Title
/html/body/div[2]/div[3]/div[2]/div/form/table/thead/tr/th[2]/a
Data
/html/body/div[2]/div[3]/div[2]/div/form/table/tbody/tr[1]/td[2]/a
Code
Ticket_Titles = driver.find_element_by_xpath('//tbody/tr/td[2]/a')

for Ticket_Title in Ticket_Titles:
    print(Ticket_Title.text)
Error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-182-6e3e609a1ea1> in <module>
      2 Ticket_Titles = driver.find_element_by_xpath('//tbody/tr/td[2]/a')
      3
----> 4 for Ticket_Title in Ticket_Titles:
      5     print(Ticket_Title.text)

TypeError: 'FirefoxWebElement' object is not iterable 
another sample
Ticket_Titles = driver.find_element_by_xpath('//tbody/tr/td[2]/a')

Ticket_Titles.text
Output:
'Export max results to Excel (may timeout)'

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros