1

I am using Selenium in Grafana, I want to be able to extract the text from one of the panels. I am beginner to Selenium hence not able to understand why this error.

Using Chro Path Utility, I have found the Relative XPath. Now I have to run the same code for multiple panels, hence I have my code as:

xpathTitle = "//span[contains(text(),'" + title + "')]"

browser.find_element_by_xpath(xpathTitle).click()

title is where I pass my Panel titles.

After running the program, I get the following error:

Message: no such element: Unable to locate element: {"method":"xpath","selector":"//span[contains(text(),'Cadvisor')]"}

I cannot use cssSelector or Absolute Path because the location of my Panel is not fixed across number of dashboards.

Can anyone help me with how to handle this? Any help will be appreciated.

Thank you.

Tech Girl
  • 169
  • 2
  • 17
  • Maybe its not a problem with the xpath but with the element actually being there when you check. Try to wait for a while before checking the element – INDIVIDUAL-IT Jun 08 '20 at 06:12
  • @Shivani Shinde Please read why a [screenshot of HTML or code or error is a bad idea](https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors). Consider updating the Question with formatted text based relevant HTML, code trials and error stack trace. – undetected Selenium Jun 08 '20 at 07:51
  • @INDIVIDUAL-IT, I understand that I missed a step of scrolling down the page and hence would get this error. – Tech Girl Jun 10 '20 at 13:20

0 Answers0