Error while locating Xpath

Asked

Viewed 218 times

0

Good afternoon, I’m having difficulty to solve this problem with Selenium, in which the code is running the automation perfectly and when it arrives at a certain element of the page that does not contain NAME or ID, because it is an inserted list I am using by Xpath.

      driver.Manage().Timeouts().ImplicitWait(TimeSpan.FromSeconds(5));
      IWebElement box = driver.FindElement(By.XPath("//*[@id=\"Account_body\"]/table/tbody/tr[2]/th/a"));
      box.Click(); 

of the following error in VS:

OpenQA.Selenium.NoSuchElementException: 'no such element: Unable to locate element: {"method":"css selector","selector":"#Account_body > table > tbody > tr.dataRow.even.first > th > a"}
  (Session info: chrome=74.0.3729.169)
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17763 x86_64)'

.i don’t know if I have to do an Attach like I’m used to Winatomation.

  • you’d like him to ignore if there’s no element, that’s it?

  • Not because the element does exist, and every time I search for Xpath is the same value

  • two possibilities then, the element hasn’t loaded yet after the five-second Wait or your xpath is wrong

  • That’s where I get the shit.. that I already put a 20s Wait to test and already checked Xpath, already told me that I should reload the page as a attach to search for the reference. I don’t know if that’s necessary in Lenium

  • 1

    pass the page there so I can take a look

  • i can give you the information along with elements code and pg with images.. as it is a Credicard system for OS cancellation

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.