I am trying to click on the last row of a table using python and selenium. I have highlighted what I am trying to click in the HTML code image.
lastRow = driver.find_element(By.CSS_SELECTOR("td.phone-leftinline yui-dt6-col-Type yui-dt-col-Type yui-dt-first:last-of-type"))
lastRow.click()
This codes keeps throwing an error:
Traceback (most recent call last):
File "/Users/daniel/Python/main.py", line 42, in <module>
lastRow = driver.find_element(By.CSS_SELECTOR("td.phone-leftinline yui-dt6-col-Type yui-dt-col-Type yui-dt-first:last-of-type"))
TypeError: 'str' object is not callable
I have also tried this with no luck:
lastRow = driver.find_element(By.XPATH("(//table[1]/tbody/tr)[last()]"));

lastRow = driver.find_element(By.XPATH("(//table[1]//tr)[last()]"));. And if you wait a couple of secs before interacting with the element? Maybe it did not load when you try to interact with it.