Python Selenium Get Text
Question:
When I try to click on an xpayh that contains some text, it rises an error
‘str’ object is not callable
Code:
some_text = 'GET'
driver.find_element(By.XPATH("//*[contains(text(), '" + some_text + "')]")).click()
Answers:
You are using a wrong syntax.
Try this:
some_text = 'GET'
driver.find_element(By.XPATH, "//*[contains(text(), '" + some_text + "')]").click()
When I try to click on an xpayh that contains some text, it rises an error
‘str’ object is not callable
Code:
some_text = 'GET'
driver.find_element(By.XPATH("//*[contains(text(), '" + some_text + "')]")).click()
You are using a wrong syntax.
Try this:
some_text = 'GET'
driver.find_element(By.XPATH, "//*[contains(text(), '" + some_text + "')]").click()