Python Forum
Getting error str object is not callable in find by xpath
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting error str object is not callable in find by xpath
#1
Here is my code segment -

for clk in range(1, int(lim)):
    for i in range(1, 101):
        tab_str = '//*[@id="tbody_other_search"]/tr['
        tab_str = tab_str + str(i) + ']/td[1]'
        print(tab_str)
        driver.find_element_by_xpath(tab_str).text()
        '''if int(num) % 100 == int(en_dig):
            print(num)'''
        driver.find_element_by_xpath('//*[@id="names_load_next"]/a/i').click()
    WebDriverWait(driver,5)
I confirmed that the correct xpath is generated in tab_str by the printing the xpath but getting the error for the line -
driver.find_element_by_xpath(tab_str).text()
and here is the error -
Error:
driver.find_element_by_xpath(tab_str).text() TypeError: 'str' object is not callable
What is the reason of error? please share with me.
Reply


Messages In This Thread
Getting error str object is not callable in find by xpath - by sumandas89 - Aug-14-2018, 10:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error in class: TypeError: 'str' object is not callable akbarza 2 583 Dec-30-2023, 04:35 PM
Last Post: deanhystad
  TypeError: 'NoneType' object is not callable akbarza 4 1,108 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,491 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 894 Jul-23-2023, 02:25 PM
Last Post: Fare
  Error when using FIND WJSwan 2 924 Jan-27-2023, 05:49 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable #1 isdito2001 1 1,121 Jan-21-2023, 12:43 AM
Last Post: Yoriz
  selenium. xpath error 3lnyn0 1 1,570 Dec-26-2022, 02:49 PM
Last Post: snippsat
  'SSHClient' object is not callable 3lnyn0 1 1,218 Dec-15-2022, 03:40 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,527 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov
  API Post issue "TypeError: 'str' object is not callable" makeeley 2 1,986 Oct-30-2022, 12:53 PM
Last Post: makeeley

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020