c# - Selenium webdriver. Reading an earlier line -


Using Selenium WebDriver is trying to automate some tests for our projects and C # and I have the following status I came in: When I try to test the main menu, something flows like this:

  1. Click on the first menu item (located at the top of the page)
  2. Wait for the last element in the page to load so that I Make sure the content is completely full (sometimes it takes 15-20 seconds for full page load)
  3. Specify the title text in a single device under the main text << / Li>
  4. Click on the next menu item and continue with the same type of flow

    Now my problem is that after the page is loaded and the title of the test title (3) I get an accident, I think this is happening. Onki C # only read once material and can not return to the last element once read it. So my solution that I thought would take me out first to define body tags in a variable and then it says for emphasis and loud navigation: var body = driver .FindElement (By.TagName ("tan")); . Driver.FindElement (By.XPath ("/ html / body / div [1] / div / div [2] / div [2] / div [2]")) (click); // Click on the first item in the main menu driver. VaitForElement (By.XPath ("/ html / path_to_the_last_last / div [1]")); // The last element on the page is waiting for Assert.AreEqual ("title text", body.FindElement (By.XPath ("/ html / body / div [1] / div / div [3] / div [3] ] / Div [1] / div / div [1] / div [1] / div [1] / div [1] / div ")) Text.Trim ()). // Calling the initial set variable body insists the title text. Fidalment (Byte xpath ("/ html / body / div [1] / div / div [2] / div [2] / div [3]")) .click (); // Click on the next item in the main menu // Equal flow

    to continue to check every menu until it is said that when WebDriver says that That's about implementing the extreme - where the variable was called for the first time, it crashes with the following error:

    OpenXA Selenium: Staleel Reference Reference: The element is not found in the cache - the page has changed because it has been seen

    Any ideas that I did wrong and how should I proceed ?

    My guess is that when the body element, your path can not start with the root. So you should say:

      body.FindElement (By.XPath (". / Div [1] / div / div [3] / div [3] / div [1]] / The first dot means your body element.  


Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -