Selenium – You are using the code shown below to handle Dynamic WebTables with Selenium in C#…


You are using the code shown below to handle Dynamic WebTables with Selenium in C#. However, parts of the code are incomplete. Identify and complete the code snippets that are missing and complete the code.

using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System.Collections.Generic;
namespace SeleniumTest
{
 class Program
 {
 static void Main(string[] args)
 {
 IWebDriver driver = new FirefoxDriver();
 driver.Manage().Window.Maximize();

driver.Navigate().GoToUrl("https://website-link");
 driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
 
 var elemTable = Blank 1 
List<IWebElement> lstTrElem = new List<IWebElement>(Blank 2);
 
String strRowData = "";
 
 foreach (var elemTr in lstTrElem)
 {
 List<IWebElement> lstTdElem = new List<IWebElement>(Blank 3);
 if (lstTdElem.Count > 0)
 {
 foreach (var elemTd in lstTdElem)
 {
                strRowData = strRowData + elemTd.Text + “\t\t";
 }
 }
 else
 {
 Console.WriteLine("This is Header Row");
 Console.WriteLine(Blank4(" ", "\t\t"));
 }
 Console.WriteLine(strRowData);
 strRowData = String.Empty;
 }
 Console.WriteLine("");
 Blank 5
 }
 }
}

What should be used at Blank3 to get all the Columns of table with tag ‘td’?

Related Posts

Close Bitnami banner
Bitnami