0

It is in relation to this question. Reload DOM element in selenium webdriver after some new tag added. But I want to take this one step further. I have a table, and I basically get the element down to the row level. When you click it, it opens another table within its row. I then want to grab that table, from within that webelemnt of row that has a new table in it. I would not like have to go through the main table of rows to get to the row that just opened. Do I need to do this, or is there someway to reload the already loaded element with what was updated?

        var section = Driver.Instance.FindElement(By.TagName("tbody"));
        var table = section.FindElement(By.Id("UP2"));
        //set the values and get the new calculation
        var rows = table.FindElements(By.TagName("tr"));
        var rowCount = 0;
        foreach (var row in rows)
        {
          if (rowCount > 0)
          {

            var columns = row.FindElements(By.TagName("td"));
            columns[1].Click(); //Where it expands the new table
            Thread.Sleep(2000);
            WebDriverWait wait = new WebDriverWait(Driver.Instance, new TimeSpan(10));

            var testTable = row.FindElement(By.TagName("table"));
            var testRows = testTable.FindElements(By.TagName("tr"));
            foreach (var testRow in testRows)
            {
              //trying to get the second table
              var testColumns = testRow.FindElements(By.TagName("td"));
            }
Greg P
  • 772
  • 2
  • 10
  • 23
  • why do you need to reload the table? you should be able to get to it step by step... or are you looking to get the info without doing all the steps? – Moshe Slavin Feb 14 '19 at 14:31
  • you should add some HTML or give the website and show what you have tried... – Moshe Slavin Feb 14 '19 at 14:31
  • Well, I would have to go thru all the same steps to get where I left off, and get the new table that is now showing up in the dom.. I rather skip out of going thru the table and remembering where I left off to pick that row again and then process the table that is under it..will post the code in the main ticket. – Greg P Feb 14 '19 at 14:34
  • Without the HTML or the website we can't really help... you might need to switch to an iframe we cant know... – Moshe Slavin Feb 14 '19 at 14:37
  • it is a third party app we use, we have to stick with what we have unfortunately. Iframes I can deal with. – Greg P Feb 14 '19 at 14:39

0 Answers0